php - 使用PHP从JSON获取数据

标签 php json

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

相关文章:

javascript - 使用javascript读写json文件

python - 使用 Python 解析 JSON

ios - AFNetworking 与 BaaS?

php - 在 codeigniter 页面中动态添加 css 类

php - 使用 laravel-mongodb 配置 oauth2-server-laravel

php - 具有多种方法的 zend view helper?

iphone - 将 JSON 格式的 NSString 转换为 NSMutableDictionary

php - 我尝试使用 Php、MySQL 在 android 中注册表单并使用 JSON 解析进行响应,但详细信息未插入表中

php - Codeigniter Active Record - 以特定 ID 开始查询?

php - 在 MySQL JSON 字段的数组中搜索值 (Laravel/Lumen)