public function TrustedRedirectResponse::__construct

public TrustedRedirectResponse::__construct($url, $status = 302, $headers = array())

Creates a redirect response so that it conforms to the rules defined for a redirect status code.

Parameters

string $url The URL to redirect to. The URL should be a full URL, with schema etc.,: but practically every browser redirects on paths only as well

int $status The status code (302 by default):

array $headers The headers (Location is always set to the given URL):

Throws

\InvalidArgumentException

Overrides RedirectResponse::__construct

See also

http://tools.ietf.org/html/rfc2616#section-10.3

File

core/lib/Drupal/Core/Routing/TrustedRedirectResponse.php, line 24

Class

TrustedRedirectResponse
Provides a redirect response which contains trusted URLs.

Namespace

Drupal\Core\Routing

Code

public function __construct($url, $status = 302, $headers = array()) {
  $this->trustedUrls[$url] = TRUE;
  parent::__construct($url, $status, $headers);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!TrustedRedirectResponse.php/function/TrustedRedirectResponse::__construct/8.1.x