Php 可能编码错误、格式错误的UTF-8字符
我正在尝试获取laravel中的记录,然后它将给我以下错误 格式错误的UTF-8字符,可能编码错误 这是我的密码Php 可能编码错误、格式错误的UTF-8字符,php,json,laravel,utf-8,Php,Json,Laravel,Utf 8,我正在尝试获取laravel中的记录,然后它将给我以下错误 格式错误的UTF-8字符,可能编码错误 这是我的密码 $Login = DB::table('usermaster') ->where('Email', $uname) ->where('Password', md5($password)) ->get(); return response()->json($Login); 在我的laravel查询
$Login = DB::table('usermaster')
->where('Email', $uname)
->where('Password', md5($password))
->get();
return response()->json($Login);
在我的laravel查询中,我使用了以下代码,因此它将给出这种类型的错误 格式错误的UTF-8字符,可能编码不正确 但我将通过执行以下代码来解决此错误
$BvoData = DB::table('test1')->select('test1.*')
->where("test1.Id", "".$id."")
->first();
$BvoData = (array) $BvoData;
$BvoData->temp1 = DB::table('temp1')->where('tmpdata', $BvoData->tmpdata)->get();
$BvoData["temp1"] = json_decode(json_encode($BvoData["temp1"]), True);
$BvoData->temp2 = DB::table('temp2')->where('Id', $id)->get();
$BvoData["temp2"] = json_decode(json_encode($BvoData["temp2"]), True);
return response()->json($BvoData);
通过使用json_decode和json_encode,我解决了我的问题…您是否看到了此解决方案不适用于我,仍然收到“消息”:“格式错误的UTF-8字符,可能编码错误”,“错误”。谢谢。
$BvoData = DB::table('test1')->select('test1.*')
->where("test1.Id", "".$id."")
->first();
$BvoData = (array) $BvoData;
$BvoData->temp1 = DB::table('temp1')->where('tmpdata', $BvoData->tmpdata)->get();
$BvoData["temp1"] = json_decode(json_encode($BvoData["temp1"]), True);
$BvoData->temp2 = DB::table('temp2')->where('Id', $id)->get();
$BvoData["temp2"] = json_decode(json_encode($BvoData["temp2"]), True);
return response()->json($BvoData);