时间:2021-07-01 10:21:17 帮助过:5人阅读
function curIp(){
$ip='';
if(getenv('HTTP_CLIENT_IP') and strcasecmp(getenv('HTTP_CLIENT_IP'),'unknown')){
$ip=getenv('HTTP_CLIENT_IP');
}elseif(getenv('HTTP_X_FORWARDED_FOR') and strcasecmp(getenv('HTTP_X_FORWARDED_FOR'),'unknown')){
$ip=getenv('HTTP_X_FORWARDED_FOR');
}elseif(getenv('REMOTE_ADDR') and strcasecmp(getenv('REMOTE_ADDR'),'unknown')){
$ip=getenv('REMOTE_ADDR');
}elseif(isset($_SERVER['REMOTE_ADDR']) and $_SERVER['REMOTE_ADDR'] and strcasecmp($_SERVER['REMOTE_ADDR'],'unknown')){
$ip=$_SERVER['REMOTE_ADDR'];
}else{
$ip='127.0.0.1';
}
return $ip;
}