Header values
Supported headers
- Accept
- Accept-Charset
- AcceptLanguage
- Authorization
- Content-Disposition
- Content-Length
- Content-Type
- Cookie
Parsing header value
// A router request controller
function handleRequest (ServerRequestInterface $request)
{
$contentType = HeaderValueFactory::createFromMessage($response,
HeaderField::CONTENT_TYPE);
if ($contentType instanceof ContentTypeHeaderValue)
{
$mediaType = $contentType->getMediaType();
// do something...
}
}
References
- [RFC 2616 Header Field Definitions](https://datatracker.ietf.org/doc/html/