您的位置:首页 > 编程语言 > PHP开发

php getallheaders使用注意事项

2014-06-18 10:52 281 查看
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;
}
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: