2015-09-29 74 views

回答

1

您可以使用此:

$ip是用戶的IP地址。

$ip = $_SERVER['REMOTE_ADDR']; 
    $data = file_get_contents("http://www.geoplugin.net/json.gp?ip=". $ip); 
    $data = json_decode($data); 

echo $data->geoplugin_countryName; // and so on 
+0

感謝它的工作。 –

相關問題