//获取客户端IP地址 function getIP() { $remoteip = ""; if(getenv('HTTP_CLIENT_IP')) { $remoteip = getenv('HTTP_CLIENT_IP'); } elseif(getenv('HTTP_X_FORWARDED_FOR')) { $remoteip = getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('REMOTE_ADDR')) { $remoteip = getenv('REMOTE_ADDR'); } else { $remoteip = $HTTP_SERVER_VARS['REMOTE_ADDR']; } return $remoteip; }