我试图从WoWProgress API中提取数据。我想在线解析数据,并直接解码它们,同时发布它们以供查看。我仍然在学习,但是我似乎遇到了这个数组的问题。真的需要一些帮助。JSON解析PHP的问题
$json = file_get_contents("http://www.wowprogress.com/guild/eu/twisting-nether/hellenic%20horde/json_rank");
if($json == false)
{
throw new Exception("Failed To load infomation. Check setup options");
}
$result = json_decode($json, true);
echo "<pre>";
foreach ($result["realm_rank"] as $value) {
print_r($value);
}
echo "</pre>";
但所有我获得的是 “提供的foreach无效参数()”
更喜欢一些帮助。 在此先感谢!
对不起,我的英语。英语不是我的母语。
看起来像'$ result [“realm_rank”]'是一个整数值,而不是数组。 –
var_dump($ result); –