function GetIP() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
//如果变量是非空或非零的值,则 empty()返回 FALSE。
$IP = explode(',',$_SERVER['HTTP_CLIENT_IP']);
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$IP = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
}
elseif (!empty($_SERVER['REMOTE_ADDR'])) {
$IP = explode(',',$_SERVER['REMOTE_ADDR']);
}
else {
$IP[0] = 'None';
}
return $IP[0];
}
获取手机浏览器IP的函数