Neos\Flow\Http\Uri::getHost PHP Метод

getHost() публичный Метод

Returns the host(s) of the URI
public getHost ( ) : string
Результат string The hostname(s)
    public function getHost()
    {
        return $this->host;
    }

Usage Example

Пример #1
0
 /**
  * Creates a new Request object from the given data.
  *
  * @param Uri $uri The request URI
  * @param string $method Request method, for example "GET"
  * @param array $arguments Arguments to send in the request body
  * @param array $files
  * @param array $server
  * @return Request
  * @api
  */
 public static function create(Uri $uri, $method = 'GET', array $arguments = [], array $files = [], array $server = [])
 {
     $get = $uri->getArguments();
     $post = $arguments;
     $isDefaultPort = $uri->getScheme() === 'https' ? $uri->getPort() === 443 : $uri->getPort() === 80;
     $defaultServerEnvironment = ['HTTP_USER_AGENT' => 'Flow/' . FLOW_VERSION_BRANCH . '.x', 'HTTP_HOST' => $uri->getHost() . ($isDefaultPort !== true && $uri->getPort() !== null ? ':' . $uri->getPort() : ''), 'SERVER_NAME' => $uri->getHost(), 'SERVER_ADDR' => '127.0.0.1', 'SERVER_PORT' => $uri->getPort() ?: 80, 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_FILENAME' => FLOW_PATH_WEB . 'index.php', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php'];
     if ($uri->getScheme() === 'https') {
         $defaultServerEnvironment['HTTPS'] = 'on';
         $defaultServerEnvironment['SERVER_PORT'] = $uri->getPort() ?: 443;
     }
     if (in_array($method, ['POST', 'PUT', 'DELETE'])) {
         $defaultServerEnvironment['HTTP_CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
     }
     $query = (string) $uri->getQuery();
     $fragment = $uri->getFragment();
     $overrideValues = ['REQUEST_URI' => $uri->getPath() . ($query !== '' ? '?' . $query : '') . ($fragment !== '' ? '#' . $fragment : ''), 'REQUEST_METHOD' => $method, 'QUERY_STRING' => $query];
     $server = array_replace($defaultServerEnvironment, $server, $overrideValues);
     return new static($get, $post, $files, $server);
 }
All Usage Examples Of Neos\Flow\Http\Uri::getHost