public function positioning(){
if(Request() -> isPost()){
header("Content-type:text/html;charset=utf-8");
//维度
//$lat=input('post.lat');
$lat="37.47517";
//经度
//$lng=input('post.lng');
$lng="121.37377";
$str = "https://apis.map.qq.com/ws/geocoder/v1/?location=$lat,$lng&key="."腾讯地图申请key值"."&get_poi=1";
$content = file_get_contents($str);
$arr = json_decode($content, true);
return json(['status' => 1,'arr' => $arr]);
}
}
输出值
{
"status": 1,
"arr": {
"status": 0,
"message": "query ok",
"request_id": "090e2a6e-2b2d-11ec-a3bc-525400ad3e61",
"result": {
"location": {
"lat": 37.47517,
"lng": 121.37377
},
"address": "山东省烟台市芝罘区通世南路",
"formatted_addresses": {
"recommend": "芝罘区山东省烟台第十五中学(通世南路西)",
"rough": "芝罘区山东省烟台第十五中学(通世南路西)"
},
"address_component": {
"nation": "中国",
"province": "山东省",
"city": "烟台市",
"district": "芝罘区",
"street": "通世南路",
"street_number": "通世南路"
},
"ad_info": {
"nation_code": "156",
"adcode": "370602",
"city_code": "156370600",
"name": "中国,山东省,烟台市,芝罘区",
"location": {
"lat": 37.415199,
"lng": 121.375
},
"nation": "中国",
"province": "山东省",
"city": "烟台市",
"district": "芝罘区"
},
"address_reference": {
"street_number": {
"id": "",
"title": "",