php getallheaders使用注意事项

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;
    }
}

  

php getallheaders使用注意事项,布布扣,bubuko.com

php getallheaders使用注意事项

上一篇:Netty权威指南


下一篇:yiic创建YII应用 "php.exe"不是内部或外部命令 解决办法