您的位置:首页 > 编程语言 > PHP开发

[置顶] PHP根据经纬度获取地址信息

2017-08-17 15:13 916 查看
<?php

$longitude=$longitude;//用户当前定位的经度

$latitude=$latitude;//用户当前定位的纬度
      $place_url='http://api.map.baidu.com/geocoder/v2/?location='.$latitude.','.$longitude.'&output=json&ak=你的密钥';
      $json_place=file_get_contents($place_url);   
      $place_arr=json_decode($json_place,true);  
       print_r($json_place) ;

      $address=$place_arr['result']['formatted_address'];

?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: