<?php
header("content-type:text/html;charset=utf-8");
function ipjwd() {
$getIp=$_SERVER["REMOTE_ADDR"];
if ($getIp=='127.0.0.1') {
$getIp='58.30.228.35';
}

$content = file_get_contents("http://api.map.baidu.com/location/ip?ak=您的密钥");
$json = json_decode($content);
//return $json;
$data='';
$data['ip']=$getIp;
$data['log']=$json->{'content'}->{'point'}->{'x'};//按层级关系提取经度数据
$data['lat']=$json->{'content'}->{'point'}->{'y'};//按层级关系提取纬度数据
$data['address']=$json->{'content'}->{'address'};//按层级关系提取address数据
return $data; 
}
var_dump(ipjwd());
?>

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-11-08
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2021-08-11
  • 2021-11-19
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案