public function MessageTrait::getHeaders in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-diactoros/src/MessageTrait.php \Zend\Diactoros\MessageTrait::getHeaders()
- 8 vendor/guzzlehttp/psr7/src/MessageTrait.php \GuzzleHttp\Psr7\MessageTrait::getHeaders()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/MessageTrait.php \Zend\Diactoros\MessageTrait::getHeaders()
Retrieves all message headers.
The keys represent the header name as it will be sent over the wire, and each value is an array of strings associated with the header.
// Represent the headers as a string foreach ($message->getHeaders() as $name => $values) { echo $name . ": " . implode(", ", $values); }
// Emit headers iteratively: foreach ($message->getHeaders() as $name => $values) { foreach ($values as $value) { header(sprintf('%s: %s', $name, $value), false); } }
Return value
array Returns an associative array of the message's headers. Each key MUST be a header name, and each value MUST be an array of strings.
1 method overrides MessageTrait::getHeaders()
- Request::getHeaders in vendor/
zendframework/ zend-diactoros/ src/ Request.php - Retrieves all message headers.
File
- vendor/
zendframework/ zend-diactoros/ src/ MessageTrait.php, line 99
Class
- MessageTrait
- Trait implementing the various methods defined in MessageInterface.
Namespace
Zend\DiactorosCode
public function getHeaders() {
return $this->headers;
}