0
字符串我有一个名为$ graphData一个JSON对象,当我使用<?php echo var_dump(json_decode($graphData)); ?>
我得到如下:获取从JSON对象
object(stdClass)[987]
public 'myself' =>
object(stdClass)[984]
public '1' =>
object(stdClass)[986]
public 'id' => string '999999999' (length=9)
public 'value' => string '4.2' (length=3)
public 'name' => string 'Myself' (length=6)
public 'owner' => string '' (length=0)
public 'type' => int 1
public 'children' =>
array (size=0)
...
public 'my_teams' =>
array (size=0)
empty
public 'my_units' =>
array (size=0)
empty
public 'companies' =>
array (size=1)
0 =>
object(stdClass)[982]
public 'id' => string '66' (length=2)
public 'name' => string 'Company' (length=8)
public 'owner' => string 'Name Name' (length=13)
public 'value' => string '4.2' (length=3)
public 'type' => string '4' (length=1)
public 'children' =>
array (size=0)
...
如何访问标有“价值”的字符串,并与值4.2?
感谢
//编辑:我需要在PHP或JS代码
那么你尝试什么?这是两种语言中的一项微不足道的任务。 – Qix 2014-09-20 23:46:25
你有没有尝试迭代“公司”? – 2014-09-20 23:47:13