在Google地图网站上,您可以搜索名为“我的位置”的地址,该地址会对您的IP地址进行地理编码查询。
google API中是否提供此功能?
答案 0 :(得分:1)
Google不提供该功能。但是,现代浏览器支持HTML5 Geolocation,它为您提供JavaScript中的功能: https://developers.google.com/maps/articles/geolocation
目前Google并未直接提供此功能。
答案 1 :(得分:0)
您可以使用以下代码对IP地址进行地理编码:
function functionname(Your IP Here)
{
$ip = $ClientIP;
$json = file_get_contents("http://api.easyjquery.com/ips/?ip=".$ip."&full=true");
$json = json_decode($json,true);
return $json;
}