【发布时间】:2013-12-22 01:22:38
【问题描述】:
在 PHP 中使用 JSON 并且该错误不断弹出。我正在使用的 PHP 代码是
echo $JSON["response"]["players"][0]["steamid"];
实际的 JSON 是对的 here. var dump 是
array(1) { ["response"]=> array(1) { ["players"]=> array(0) { } } }
I used an online JSON viewer and it looks just fine to me.
有人有什么想法吗?
【问题讨论】:
-
播放器没有索引,为空
-
$JSON["response"]["players"][0]["steamid"];不存在。
-
玩家为空。所以没有索引 0。0 将是第一个元素。
-
剪辑。问题在于获取 JSON 的请求。这是一个错误的请求,所以玩家数组是空的。谢谢大家。
标签: php json undefined offset steam