-
Notifications
You must be signed in to change notification settings - Fork 1
Message: getHeaders Example
Terry L edited this page Jun 20, 2020
·
3 revisions
Shieldon\Psr7\Message
Retrieves all message header values.
-
return
array
(string[][]
) Each key is a header name, and each value is an array of strings for that header
Example:
$headers = $message->getHeaders();
print(print_r($headers, true));
/* Outputs:
Array
(
[user-agent] => Array
(
[0] => Mozilla/5.0 (Windows NT 10.0; Win64; x64)
)
[host] => Array
(
[0] => 127.0.0.1
)
[accept] => Array
(
[0] => text/html,application/xhtml+xml,application/xml;q=0.9
)
[accept_charset] => Array
(
[0] => ISO-8859-1,utf-8;q=0.7,*;q=0.3
)
[accept_language] => Array
(
[0] => en-US,en;q=0.9,zh-TW;q=0.8,zh;q=0.7
)
)
*/
composer require shieldon/psr-http
Shieldon PSR HTTP implementation written by Terry L. from Taiwan.