标签:
function getAddr()
{
if (!empty($_SERVER[‘HTTP_CLIENT_IP‘])) {
$ip=$_SERVER[‘HTTP_CLIENT_IP‘];
} elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR‘])) {
$ip=$_SERVER[‘HTTP_X_FORWARDED_FOR‘];
} else {
$ip=$_SERVER[‘REMOTE_ADDR‘];
}
return $ip;
}
echo getAddr();
标签:
原文地址:http://www.cnblogs.com/sixiong/p/4391131.html