public function Response::setExpires in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-foundation/Response.php \Symfony\Component\HttpFoundation\Response::setExpires()
Sets the Expires HTTP header with a DateTime instance.
Passing null as value will remove the header.
Parameters
\DateTime|null $date A \DateTime instance or null to remove the header:
Return value
File
- vendor/
symfony/ http-foundation/ Response.php, line 681
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function setExpires(\DateTime $date = null) {
if (null === $date) {
$this->headers
->remove('Expires');
}
else {
$date = clone $date;
$date
->setTimezone(new \DateTimeZone('UTC'));
$this->headers
->set('Expires', $date
->format('D, d M Y H:i:s') . ' GMT');
}
return $this;
}