{"count":{"左脑":2,"右脑":3,"全脑":2,"全脑1":1},"score":{"左脑":8,"右脑":14,"全脑":15,"全脑1":8},"pingjun":{"左脑":4,"右脑":4.6666666666667,"全脑":7.5,"全脑1":8}} 如何读取 json里面的 pingjun这个值
2 回答
杨__羊羊
TA贡献1943条经验 获得超7个赞
示例代码如下:
<?php header( "Content-type: text/html; charset=utf-8" ); $postArray = '[{"count":{"左脑":2,"右脑":3,"全脑":2,"全脑1":1},"score":{"左脑":8,"右脑":14,"全脑":15,"全脑1":8},"pingjun":{"左脑":4,"右脑":4.6666666666667,"全脑":7.5,"全脑1":8}}]' ; $de_json = json_decode( $postArray , true); echo $de_json [0][ 'pingjun' ][ '左脑' ]; ?> |
json 数组结构如图:
森栏
TA贡献1810条经验 获得超5个赞
$a = '{"count":{"左脑":2,"右脑":3,"全脑":2,"全脑1":1},"score":{"左脑":8,"右脑":14,"全脑":15,"全脑1":8},"pingjun":{"左脑":4,"右脑":4.6666666666667,"全脑":7.5,"全脑1":8}}';
$b = json_decode($a);
$status = $b->pingjun;
- 2 回答
- 0 关注
- 379 浏览
添加回答
举报
0/150
提交
取消