这是json
[{"location":"USA","email":"test@test.com","sex":"male","age":"Unkown","other":null,"profile":{"net":["55","56"],"networks":[{"site_url":"http://site.com","network":"test","username":"mike"},{"site_url":"http://site.com/2","network":"test2","username":"mike2"}]},"name":"Mike Jones","id":111}]
我想知道如何回显所有网络,以便回显2个站点的site_url,network和user。
我还将如何在结尾处获得“名称”?
坦克!
最佳答案
使用json_decode()
http://php.net/manual/en/function.json-decode.php
$data = json_decode(...your sstring ...);
echo $data[0]->name;
关于php - 使用PHP从JSON获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3899553/