gpt4 book ai didi

php - 使用PHP从JSON获取数据

转载 作者:行者123 更新时间:2023-12-04 14:48:47 25 4
gpt4 key购买 nike

这是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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com