Request::getHost PHP Method

getHost() public static method

This method can read the client host name from the "X-Forwarded-Host" header when trusted proxies were set via "setTrustedProxies()". The "X-Forwarded-Host" header must contain the client host name. If your reverse proxy uses a different header name than "X-Forwarded-Host", configure it via "setTrustedHeaderName()" with the "client-host" key.
public static getHost ( ) : string
return string
        public static function getHost()
        {
            //Method inherited from \Symfony\Component\HttpFoundation\Request
            return \Illuminate\Http\Request::getHost();
        }

Usage Example

Example #1
0
 /**
  * Returns true if the host of both specified requests match.
  *
  * @param  Request $first  First request to match.
  * @param  Request $second Second request to match.
  *
  * @return boolean True if the host of both specified requests match.
  */
 public static function matchHost(Request $first, Request $second)
 {
     if (null !== $first->getHost() && !preg_match('#' . str_replace('#', '\\#', $first->getHost()) . '#i', $second->getHost())) {
         return false;
     }
     return true;
 }
All Usage Examples Of Request::getHost