高德地图 使用php根据详细地址获取经度纬度的方法代码
<?php
$key="b2f2018qipa250123458bc962c4qipa250";
$address="北京市朝阳区阜通东大街6号";
$regeo_url="https://restapi.amap.com/v3/geocode/geo";
$address_location=$regeo_url."?output=JSON&address=$address&key=$key";
$data_location=file_get_contents($address_location);
$result_local=json_decode($data_location,true);
$local_status=$result_local['status'];
$local_infocode=$result_local['infocode'];
$address=array();
if($local_status==1 && $local_infocode== 10000 ){
$local_geocode=$result_local['geocodes'];
$location=$local_geocode[0]['location'];
echo "<pre>";
print_r($location);
$location_ay=explode(",",$location);
echo "<pre>";
print_r($location_ay);
}else{
echo "不能查询出数据";
}
?>