src/LogAction.php
private static function requestIp()
    {
        if (isset($_SERVER['HTTP_REMOTEIP'])) {
            return $_SERVER['HTTP_REMOTEIP'];
        }
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            return explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
        }
        if (isset($_SERVER['HTTP_X_REAL_IP'])) {
            return $_SERVER['HTTP_X_REAL_IP'];
        }
        return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
    }
private static function requestIp()
    {
        if (isset($_SERVER['HTTP_REMOTEIP'])) {
            return $_SERVER['HTTP_REMOTEIP'];
        }
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            return explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0];
        }
        if (isset($_SERVER['HTTP_X_REAL_IP'])) {
            return $_SERVER['HTTP_X_REAL_IP'];
        }
        return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
    }
private static function requestIp ( ) { if ( isset ( $ _SERVER [ 'HTTP_REMOTEIP' ] ) ) { return $ _SERVER [ 'HTTP_REMOTEIP' ] ; } if ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) ) { return explode ( ',' , $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ) [ 0 ] ; } if ( isset ( $ _SERVER [ 'HTTP_X_REAL_IP' ] ) ) { return $ _SERVER [ 'HTTP_X_REAL_IP' ] ; } return isset ( $ _SERVER [ 'REMOTE_ADDR' ] ) ? $ _SERVER [ 'REMOTE_ADDR' ] : '' ; }
获取访问的用户IP
@return string
获取访问的用户IP