getallheaders()


foreach (getallheaders() as $name => $value) {
    echo "$name: $value\n";
}
Copy the code
if(! function_exists('getallheaders'))
{
    function getallheaders()
    {
           $headers = [];
       foreach ($_SERVER as $name => $value)
       {
           if (substr($name, 0.5) = ='HTTP_')
           {
               $headers[str_replace(' '.The '-', ucwords(strtolower(str_replace('_'.' ', substr($name, 5)))))] = $value; }}return$headers; }}Copy the code