public function GetADI($name = '')
{
$url = "http://api.map.baidu.com/geocoder?address=" . $name . "&output=json&key=37492c0ee6f924cb5e934fa08c6b1676";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
$file_data = curl_exec($ch);
curl_close($ch);
$file_data = json_decode($file_data, true);
if ($file_data['status'] == 'OK') {
$add[] = $file_data['result']['location']['lng'];
$add[] = $file_data['result']['location']['lat'];
return $add;
}
}
城市名获取经纬度
最新推荐文章于 2022-05-29 15:51:18 发布