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使用注意事项,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。