PHP取得用户真实IP
程序员文章站
2022-06-07 10:20:27
...
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 function getIp() { if($_SERVER['HTTP_CLIENT_IP']) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入
function getIp() {
if($_SERVER['HTTP_CLIENT_IP']) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
}
上一篇: mysql查询区分大小写高性能