0
我使用当前函数解析JSON文件:随机误差
function getRemoteJson($uri, $decode=true, $noob=false){
if($uri){
$fp = fopen($uri, "r");
$json = trim(file_get_contents($fp));
fclose($fp);
if($decode) return json_decode($json, true);
else return $json;
}
else return false;
}
与此文件正常工作: http://webcast-a.live.sportingpulse.com/matches/3886/09/18/90/33S64Il4cTaxQ/data.json
但是,这回我的空当我使用一个: http://webcast-a.live.sportingpulse.com/matches/3886/09/18/94/84Q4GEVlZs4rg/data.json
没有错误代码时,我分析这个文件(即json_last_error()返回JSON_ERROR_NONE)
当我使用一个在线工具检查格式,文件解析...
谢谢如果您有任何线索
是第二JSON文件中读取? var_dump($ json)是否返回任何内容?阅读文件时,您正在禁止错误...取出@符号,看看它是否会导致任何错误。 – Gavin
这里我var_dump($ json)后返回我:null 当我使用该工具:http://json.parser.online.fr/ 该文件被正确解析 –
然后它不被读取。删除@符号并查看原因。 – Gavin