如何将格式数组上的字符串转换为数组
How to convert string on format array to array
我有一个这种格式的字符串变量:
$array = '[{"name":"jack","address":"who knows"},{"name":"jill","address":"who knows too"}]';
如何从
中获取价值
$array[0]['name']; //value is 'jack'
https://juderosario.com/2016/09/01/parsing-json-with-php/
好的,我从那里得到它
$json = '[ {"id":"1", "name":"foo" }, {"id":"2", "name":"bar" } ]';
$baz = json_decode($json,true);
echo($baz[1]['name']); //bar
我有一个这种格式的字符串变量:
$array = '[{"name":"jack","address":"who knows"},{"name":"jill","address":"who knows too"}]';
如何从
中获取价值$array[0]['name']; //value is 'jack'
https://juderosario.com/2016/09/01/parsing-json-with-php/
好的,我从那里得到它
$json = '[ {"id":"1", "name":"foo" }, {"id":"2", "name":"bar" } ]';
$baz = json_decode($json,true);
echo($baz[1]['name']); //bar