当前位置:Gxlcms > PHP教程 > josn转数组有关问题

josn转数组有关问题

时间:2021-07-01 10:21:17 帮助过:17人阅读

josn转数组问题
http://rate.tmall.com/list_detail_rate.htm?itemId=37206718528 打开这个网址就是淘宝评论的一个JOSN数据,本人用json_decode转换没效果,请问这是什么原因呢?
详细代码如下

$html= file_get_contents("http://rate.tmall.com/list_detail_rate.htm?itemId=37206718528&spuId=248125721&sellerId=1975404340&order=1¤tPage=1&append=0&content=1&tagId=&posi=&picture=&ua=117tpOWUuXBidH1MRUwx%2BKHgvfSh%2BLXooZRhg%3D%3D%7CtaBkcTQxdEEUgeTB5OH0YbY%3D%7CtJFV4sagOBFJIdlQdLCUoaSARGAXj2cv166Xs2Sz%7Cs6aDR2N2MzZzRhOG48bj5vNmw8YiB4L3YmdyB5Ln8veC9%2FKHEjbh%7Csqcy9kFkoPVgpLGUUHRB1WD44BisGIw1rcXhNuE%3D%7CsYRA9%2BLH8jYz9%2BLn4pdTZvOmwwcSFzJ3s8ajJuL38teSViMWk0ST%7CsPUxhqKGQhdiB8P204ZC19KX0gXS%7Cv%2Fo%2Bia2JTRiNmFxJTHl8uI2oLVgdWI");
$html = iconv("gbk", "utf-8//IGNORE",$html);
$s=json_decode($html,true);
print_r ($s);

------解决方案--------------------
$html= file_get_contents("http://rate.tmall.com/list_detail_rate.htm?itemId=37206718528&spuId=248125721&sellerId=1975404340&order=1¤tPage=1&append=0&content=1&tagId=&posi=&picture=&ua=117tpOWUuXBidH1MRUwx%2BKHgvfSh%2BLXooZRhg%3D%3D%7CtaBkcTQxdEEUgeTB5OH0YbY%3D%7CtJFV4sagOBFJIdlQdLCUoaSARGAXj2cv166Xs2Sz%7Cs6aDR2N2MzZzRhOG48bj5vNmw8YiB4L3YmdyB5Ln8veC9%2FKHEjbh%7Csqcy9kFkoPVgpLGUUHRB1WD44BisGIw1rcXhNuE%3D%7CsYRA9%2BLH8jYz9%2BLn4pdTZvOmwwcSFzJ3s8ajJuL38teSViMWk0ST%7CsPUxhqKGQhdiB8P204ZC19KX0gXS%7Cv%2Fo%2Bia2JTRiNmFxJTHl8uI2oLVgdWI");
$html = '{' . $html . '}';
$html = iconv("gbk", "utf-8//IGNORE",$html);
$s=json_decode($html,true);
print_r ($s);

人气教程排行