根據本地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); }