Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

function Request::getHttpHost

Returns the HTTP host being requested.

The port name will be appended to the host if it's non-standard.

1 call to Request::getHttpHost()
Request::getSchemeAndHttpHost in vendor/symfony/http-foundation/Request.php
Gets the scheme and HTTP host.

File

vendor/symfony/http-foundation/Request.php, line 930

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getHttpHost() : string {
    $scheme = $this->getScheme();
    $port = $this->getPort();
    if ('http' === $scheme && 80 == $port || 'https' === $scheme && 443 == $port) {
        return $this->getHost();
    }
    return $this->getHost() . ':' . $port;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal