如何使用字符串键访问json_decoded数组/通过整数来显示

时间:2016-06-06 15:20:16

标签: php json decode

json数据看起来像这样:

{"name":{"id":55555555,"name":"name" ...}}

echo $id[0]["id"];返回

  

未定义的偏移量:第12行的C:\ xampp \ htdocs \ index \ lol \ time.php中的0

echo $id["name"]["id"];返回所需的ID。

问题是“name”键不是静态的,会改变每个请求,所以如何访问id?

0 个答案:

没有答案