note 99814 modified in function.getallheaders by danbrown
| From: | danbrown@php.net | Date: | Thu, 09 Sep 2010 14:10:59 +0000 |
| Subject: | note 99814 modified in function.getallheaders by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172409@lists.php.net to get a copy of this message | ||
apache_request_headers replicement for nginx
<?php
if (!function_exists('apache_request_headers')) {
function apache_request_headers() {
foreach($_SERVER as $key=>$value) {
if (substr($key,0,5)=="HTTP_") {
$key=str_replace("
","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
$out[$key]=$value;
}else{
$out[$key]=$value;
}
}
return $out;
}
}
?>
--was--
// apache_request_headers replicement for nginx
if (!function_exists('apache_request_headers')) {
function apache_request_headers() {
foreach($_SERVER as $key=>$value) {
if (substr($key,0,5)=="HTTP_") {
$key=str_replace("
","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
$out[$key]=$value;
}else{
$out[$key]=$value;
}
}
return $out;
}
}
http://php.net/manual/en/function.getallheaders.php