public function getIp()
    {
        $keys = ['X_FORWARDED_FOR', 'HTTP_X_FORWARDED_FOR', 'CLIENT_IP', 'REMOTE_ADDR'];

        foreach ($keys as $key) {
            $ip = $this->getServerParam($key);

            if (!$ip) {
                continue;
            }

            $ip = preg_replace('/,.*$/u', '', $ip);
            $ip = trim($ip);

            return $ip;
        }

        return null;
    }
public function getIp()
    {
        $keys = ['X_FORWARDED_FOR', 'HTTP_X_FORWARDED_FOR', 'CLIENT_IP', 'REMOTE_ADDR'];

        foreach ($keys as $key) {
            $ip = $this->getServerParam($key);

            if (!$ip) {
                continue;
            }

            $ip = preg_replace('/,.*$/u', '', $ip);
            $ip = trim($ip);

            return $ip;
        }

        return null;
    }
public function getIp ( ) { $ keys = [ 'X_FORWARDED_FOR' , 'HTTP_X_FORWARDED_FOR' , 'CLIENT_IP' , 'REMOTE_ADDR' ] ; foreach ( $ keys as $ key ) { $ ip = $ this -> getServerParam ( $ key ) ; if ( ! $ ip ) { continue ; } $ ip = preg_replace ( '/,.*$/u' , '' , $ ip ) ; $ ip = trim ( $ ip ) ; return $ ip ; } return null ; }
Get request ip.

Note: This method is not part of the PSR-7 standard.

@return string|null
Get request ip .