|
发表于 2018-12-23 22:16:40
|
显示全部楼层
wwww961h 发表于 2018-12-23 22:24
变成了数组,就可以$b=json_decode($a,true);ID=$b['id'] 小写的['id'] id是数组下标,
大佬,我现在去掉了那些,但是用了
print_r(json_decode($rs,true));
之后,后面会多个1是怎么回事啊?
{"battle":[{"id":"4988318832","buser":"muddyriddl","intype":"AP deficiency","type":"JQ"},
{"id":"11423615469","buser":"17750973387","intype":"AP deficiency","type":"QP"}]}1
这样。如果删掉那一句就不会有最后的1...
function get_content($url, $cookie) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); //读取cookie
$rs = curl_exec($ch); //执行cURL抓取页面内容
curl_close($ch);
print_r(json_decode($rs,true)); |
|