note 91175 deleted from function.apache-request-headers by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 May 2009 16:13:35 +0000 |
| Subject: | note 91175 deleted from function.apache-request-headers by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156118@lists.php.net to get a copy of this message | ||
Note Submitter: Isaac Z dot Schlueter i at foohack dot com
----
I needed to use this on a Lighttpd server, so I wrote this variant on jrabbit's function.
<?php
if (!function_exists('apache_request_headers')) {
function apache_request_headers () {
static $arh = array();
if (
empty($arh)
) foreach (
$_SERVER as $key => $val
) if (
substr($key, 0, 5) === 'HTTP_'
) $arh[
str_replace(" ", "-", ucwords(
strtolower(str_replace("_", " ", substr($key, 5))))
)
] = $val;
return $arh;
}
}