我使用 PHP/MySQL。我的问题是当我使用 json_encode PHP 存储数据时,我使用双引号 ("") 获取数据。
我的控制器:
$description['content'] = $request->content;
$description['location'] = $request->location;
$description['area'] = $request->area;
$id = Auth::id();
$property = new Property();
$property->user_id = $id;
$property->title = $request->title;
$property->description = json_encode($description);
$property->status = 0;
$property->due_date = $request->due_date;
$property->save();
数据输入数据库
"{"content":"lorem ipsum sit dolor amet","location":"sby","area":"2"}"
我期望的,就像这样没有双引号:
{"content":"lorem ipsum sit dolor amet","location":"sby","area":"2"}
我的错在哪里。谢谢
慕的地6264312
SMILET
随时随地看视频慕课网APP