获取ip /** * 获取ip * @return string */protected function getIP() { if (getenv('HTTP_CLIENT_IP')) {# 检查客户端IP $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) {# 检查系统IP $ip = getenv('HTTP_X_FORW
/** * 获取ip * @return string */ protected function getIP() { if (getenv('HTTP_CLIENT_IP')) {# 检查客户端IP $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) {# 检查系统IP $ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_X_FORWARDED')) {# 检查IP $ip = getenv('HTTP_X_FORWARDED'); } elseif (getenv('HTTP_FORWARDED_FOR')) {# 检查IP $ip = getenv('HTTP_FORWARDED_FOR'); } elseif (getenv('HTTP_FORWARDED')) {# 检查IP $ip = getenv('HTTP_FORWARDED'); } else {# 检查系统内置IP $ip = $_SERVER['REMOTE_ADDR']; }#返回IP return $ip; }