更新时间:2023-01-17 12:44:28
可以使用 json_decode()
完成将第二个参数设置为true
,因为您需要数组而不是对象.
It can be done with json_decode()
, be sure to set the second argument to true
because you want an array rather than an object.
$array = json_decode($json, true); // decode json
输出:
Array
(
[id] => 1
[name] => foo
[email] => foo@test.com
)