note 84262 modified in function.getallheaders by peehaa
| From: | peehaa@php.net | Date: | Tue, 06 Jun 2017 09:53:33 +0000 |
| Subject: | note 84262 modified in function.getallheaders by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209120@lists.php.net to get a copy of this message | ||
it could be useful if you using nginx instead of apache
<?php
if (!function_exists('getallheaders'))
{
function getallheaders()
{
$headers = [];
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-',
ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
?>
--was--
it could be useful if you using nginx instead of apache
<?php
if (!function_exists('getallheaders'))
{
function getallheaders()
{
$headers = '';
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-',
ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
?>
http://php.net/manual/en/function.getallheaders.php