function Response::setLastModified
Sets the Last-Modified HTTP header with a DateTime instance.
Passing null as value will remove the header.
@final
Return value
$this
2 calls to Response::setLastModified()
- BinaryFileResponse::setAutoLastModified in vendor/
symfony/ http-foundation/ BinaryFileResponse.php - Automatically sets the Last-Modified header according the file modification date.
- Response::setCache in vendor/
symfony/ http-foundation/ Response.php - Sets the response's cache headers (validation and/or expiration).
File
-
vendor/
symfony/ http-foundation/ Response.php, line 912
Class
- Response
- Response represents an HTTP response.
Namespace
Symfony\Component\HttpFoundationCode
public function setLastModified(?\DateTimeInterface $date) : static {
if (null === $date) {
$this->headers
->remove('Last-Modified');
return $this;
}
$date = \DateTimeImmutable::createFromInterface($date);
$date = $date->setTimezone(new \DateTimeZone('UTC'));
$this->headers
->set('Last-Modified', $date->format('D, d M Y H:i:s') . ' GMT');
return $this;
}