Error when saving json to database mysql?

public function store(Request $request)
{
$image = ['http://localhost.loca/image/product/01-1627140249.jpg', 'http://localhost.loca/image/product/03-169983334.jpg'];
$product = new Product();
$product->image = json_encode($image);
$product->save();
}

And the results are stored in the database

["http:\/\/localhost.loca\/image\/product\/01-1627140249.jpg","http:\/\/localhost.loca\/image\/product\/03-169983334.jpg"]

There are \ being generated. is there any fix. Thanks.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3BBiWMq
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

How to Create Treeview with Bootstrap and jQuery

How to Add Images to Dropdown List using jQuery

jQuery Datatables with PHP, MySQL and AJAX Example