我正在努力让它发挥作用,但看不出哪里出了问题。有人可以帮忙吗?
<?php
$jsonurl = 'http://www.foxsports.com.au/internal-syndication/json/livescoreboard';
$json = file_get_contents($jsonurl,0,null,null);
$json_output = var_dump(json_decode($json,true));
echo $json_output
?>
最佳答案
提示:
初始 JSON(存储在 $json
变量中)未验证。
代码:(固定)
<?php
$jsonurl='http://www.foxsports.com.au/internal-syndication/json/livescoreboard';
$json = file_get_contents($jsonurl,0,null,null);
$json = strip_tags(str_replace("jQuery.fs['scoreboard'].data =","",$json));
$json_output = var_dump(json_decode($json,true));
echo $json_output;
?>
这会起作用。 :-)
关于PHP json_decode 带回空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9849562/