可能重复: 在PHP中提取JSONP结果集
$url_address = "http://geocoder.ca/?latt=" . $lat . "&longt=" . $lon . "&reverse=1&allna=1&geoit=xml&corner=1&jsonp=1&callback=getinfo";
$addressSet = json_decode(file_get_contents($url_address), true);当我试图访问$addressSet[0]是没有任何东西
因此,http://geocoder.ca/?latt=42.04&longt=-87.79&reverse=1&allna=1&geoit=xml&corner=1&jsonp=1&callback=getinfo返回数据,我如何解析它?
发布于 2012-11-24 21:50:35
它不是返回JSON,而是返回JSONP。不幸的是,geocoder.ca没有一个普通的JSON。
真正的问题是如何用PHP解析JSONP。见这个答案 to 在PHP中提取JSONP结果集
https://stackoverflow.com/questions/13545929
复制相似问题