public function RedirectResponse::__construct in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/http-foundation/RedirectResponse.php \Symfony\Component\HttpFoundation\RedirectResponse::__construct()
- 8 vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php \Zend\Diactoros\Response\RedirectResponse::__construct()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/Response/RedirectResponse.php \Zend\Diactoros\Response\RedirectResponse::__construct()
Create a redirect response.
Produces a redirect response with a Location header and the given status (302 by default).
Note: this method overwrites the `location` $headers value.
Parameters
string|UriInterface $uri URI for the Location header.:
int $status Integer status code for the redirect; 302 by default.:
array $headers Array of headers to use at initialization.:
Overrides Response::__construct
File
- vendor/
zendframework/ zend-diactoros/ src/ Response/ RedirectResponse.php, line 34
Class
- RedirectResponse
- Produce a redirect response.
Namespace
Zend\Diactoros\ResponseCode
public function __construct($uri, $status = 302, array $headers = []) {
if (!is_string($uri) && !$uri instanceof UriInterface) {
throw new InvalidArgumentException(sprintf('Uri provided to %s MUST be a string or Psr\\Http\\Message\\UriInterface instance; received "%s"', __CLASS__, is_object($uri) ? get_class($uri) : gettype($uri)));
}
$headers['location'] = [
(string) $uri,
];
parent::__construct('php://temp', $status, $headers);
}