为什么这一个js数据不能 json_decode 啊
本帖最后由 xiachao2008 于 2013-02-27 10:07:08 编辑
$url = "http://info.live8bo1.com:90/rjs/2012/0513_score.js?r=0.4787992987028289";<br />
echo $html = file_get_contents($url);<br />
$data_a = json_decode($html);<br />
echo "<pre class="brush:php;toolbar:false">";print_r($data_a);
로그인 후 복사
------解决方案--------------------<br />
header("content-type:text/html;charset=utf-8");<br />
$url = "http://info.live8bo1.com:90/rjs/2012/0513_score.js?r=0.4787992987028289";<br />
$html = trim(file_get_contents($url));<br />
if(ord($html[0])== 239 && ord($html[1])== 187 && ord($html[2]) == 191){<br />
$html = substr($html,3);<br />
}<br />
eval("\$data='$html';");<br />
echo "<pre class="brush:php;toolbar:false">";<br />
print_r(json_decode($data,true));<br />
로그인 후 복사