高德webapiphpcurl
我直接使用地址栏返回的内容是这样的:
{"status":"1","info":"ok","infocode":"10000","count":"1","geocodes":[{"formatted_address":"北京市朝阳区阜通东大街|6号","province":"北京市","citycode":"010","city":"北京市","district":"朝阳区","township":[],"neighborhood":{"name":[],"type":[]},"building":{"name":[],"type":[]},"adcode":"110105","street":[],"number":[],"location":"116.481229,39.990400","level":"门牌号"}]}
但使用php crul 返回的只有:{"status":"1","info":"ok","infocode":"10000","count":"0","geocodes":[]}
geocodes里面的内容没有
这是我的php后台代码片段
$requesturl="http://restapi.amap.com/v3/geocode/geo?address=北京市朝阳区阜通东大街6号&output=json&key=8ca8e28cdd92fed465d899e4798cff39";
$ch = curl_init();
curl_setopt($ch, curlopt_url, $requesturl);
curl_setopt($ch, curlopt_header, 0);
curl_setopt($ch, curlopt_returntransfer,1);
$info=curl_exec($ch);
curl_close($ch);
echo json_decode($info, true);
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号