你试过了json_decode()
吗?
如果第二个参数设置为,它将返回一个嵌套数组,true
如果省略第二个参数,它将返回嵌套对象。
php> json_decode('{"status":0,"body":{"updatetime":1371670079,"more":112,"measuregrps":[{"grpid":126426711,"attrib":2,"date":1371654000,"category":1,"measures":[{"value":8159,"type":1,"unit":-2},{"value":4530,"type":5,"unit":-2},{"value":44478,"type":6,"unit":-3},{"value":3629,"type":8,"unit":-2}]}]}}', true);
array (
'status' => 0,
'body' =>
array (
'updatetime' => 1371670079,
'more' => 112,
'measuregrps' =>
array (
0 =>
array (
'grpid' => 126426711,
'attrib' => 2,
'date' => 1371654000,
'category' => 1,
'measures' =>
array (
0 =>
array (
'value' => 8159,
'type' => 1,
'unit' => -2,
),
1 =>
array (
'value' => 4530,
'type' => 5,
'unit' => -2,
),
2 =>
array (
'value' => 44478,
'type' => 6,
'unit' => -3,
),
3 =>
array (
'value' => 3629,
'type' => 8,
'unit' => -2,
),
),
),
),
),
)