php getallheaders使用注意事项
时间:2014-06-29 00:34:44
收藏:0
阅读:288
This function is an alias for apache_request_headers(). Please read the apache_request_headers() documentation for more information on how this function works.
so if you want to use this function in any platform,you should detect if it is exists:
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; } }
评论(0)