我想用user_id搜索我的数据库,并得到金额值(int类型)
$user = (int)(request('user'));
$money = (int)(request('money'));
$data = (DB::select("select amount from user_check where user_id = '$user'"));
$array = json_decode(json_encode($data), True);
foreach ($data as $value)
{
$array[] = $value->amount;
}
if($array[0]>$money)
{
return response(['user ok'=>$array[0],'money'=>$money]);
}
else
{
//return response(['user'=>$user,'Not enough money'=>$data]);
return response('user not ok');
}
但它不起作用,它总是进入如果不知道$money有多大
MYYA
精慕HU