获取客户端真实ip
1 // 获取客户端真实ip() 2 protected function getIP() 3 { 4 global $ip; 5 if (getenv("HTTP_CLIENT_IP")) 6 $ip = getenv("HTTP_CLIENT_IP"); 7 else if(getenv("HTTP_X_FORWARDED_FOR")) 8 $ip = getenv("HTTP_X_FORWARDED_FOR"); 9 else if(getenv("REMOTE_ADDR")) 10 $ip = getenv("REMOTE_ADDR"); 11 else $ip = "Unknow"; 12 return $ip; 13 }