public function Response::sendHeaders in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::sendHeaders()
Sends HTTP headers.
Return value
1 call to Response::sendHeaders()
- Response::send in vendor/
symfony/ http-foundation/ Response.php - Sends HTTP headers and content.
File
- vendor/
symfony/ http-foundation/ Response.php, line 325
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function sendHeaders() {
// headers have already been sent by the developer
if (headers_sent()) {
return $this;
}
// status
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
// headers
foreach ($this->headers
->allPreserveCase() as $name => $values) {
foreach ($values as $value) {
header($name . ': ' . $value, false, $this->statusCode);
}
}
// cookies
foreach ($this->headers
->getCookies() as $cookie) {
setcookie($cookie
->getName(), $cookie
->getValue(), $cookie
->getExpiresTime(), $cookie
->getPath(), $cookie
->getDomain(), $cookie
->isSecure(), $cookie
->isHttpOnly());
}
return $this;
}