PHP 高德地图,获取经纬度

function addresstolatlag($address){

    $abc = "xxx学校(xx路店)";
    $key="24fb21b484f89f212dc3f4fd016e2b4d";//没有key
    $address = $abc;

    $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);

    $arr_return=[];
    $result_local=json_decode($data_location,true);
    if($result_local['status'] == 1 && $result_local['infocode']== 10000){
        $location=$result_local['geocodes'][0]['location'];

        $arr=explode(',',$location);
        $arr_return['lat']=$arr[1];
        $arr_return['log']=$arr[0];
    }
    return $arr_return;
}

你可能感兴趣的:(PHP工作后遇到的问题,php,数据库,开发语言)