阅读(2307)
赞(9)
Laravel 8 toJson() {#collection-method}
2021-07-01 16:46:22 更新
toJson
方法将集合转换成 JSON 字符串:
$collection = collect(['name' => 'Desk', 'price' => 200]);
$collection->toJson();
// '{"name":"Desk", "price":200}'
toJson
方法将集合转换成 JSON 字符串:
$collection = collect(['name' => 'Desk', 'price' => 200]);
$collection->toJson();
// '{"name":"Desk", "price":200}'