namespace App\Http\Controllers\API;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
class TryController extends Controller{
public function index($id=1){
$users=DB::select('select * from user_reg');
//$data=["a"=>"56446645","b"=>"xxx"];
//$datas = array_map('get_object_vars', $users);
$data=[];
foreach($users as $user){
$data=array_add($data, 'users', $user->user_name);
$data= array_add($data, 'pass', $user->user_psw);
}
return response()->json($data);
}
}
网友评论