根据本地ip查询接口查询出经纬度与当前路径
//通过接口获取所在地址ip
public function is_where(){
header(content-type:text/html;charset=utf8);
$content = file_get_contents(http://api.map.baidu.com/location/ip?ak=7iz6fggegohcrrkue9rj4tsq&ip={$getip}&coor=bd09ll);
//echo $getip;die;
$json = json_decode($content);
$arr = array($json->{'content'}->{'point'}->{'x'},$json->{'content'}->{'point'}->{'y'}, $json->{'content'}->{'address'});//按层级关系提取经度数据
return json_encode($arr);
}
ad:真正免费,域名+虚机+企业邮箱=0元