PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

virtual> <ebcdic2ascii
Last updated: Sat, 24 Mar 2007

view this page in

getallheaders

(PHP 4, PHP 5)

getallheaders — Získává všechny hlavičky HTTP požadavku

Popis

array getallheaders ( void )

Tato funkce vrací asociativní pole všech HTTP hlaviček v současném požadavku.

Poznámka: Hodnotu běžných CGI proměnných můžete také získat tím, že je přečtete z prostředí, což funguje, ať používáte PHP jako modu Apache nebo ne. Pokud chcete vidět seznam všech systémových proměnných definovaných tímto způsobem, použijte phpinfo().

Příklad 145. getallheaders() Example

$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
    echo "$header: $value<br>\n";
}

Tento příklad zobrazí všechny hlavičky současného požadavku.

Poznámka: getallheaders() je v současnosti podporována jen když PHP běží jako modul Apache™.



add a note add a note User Contributed Notes
getallheaders
joyview at gmail dot com
06-Jul-2008 05:52
it could be useful if you using nginx instead of apache

if (!function_exists('getallheaders'))
{
    function getallheaders()
    {
       foreach ($_SERVER as $name => $value)
       {
           if (substr($name, 0, 5) == 'HTTP_')
           {
               $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
           }
       }
       return $headers;
    }
}
lorro at lorro dot hu
19-Apr-2005 03:25
Beware that RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities. Therefore, array keys of getallheaders() should be converted first to lower- or uppercase and processed such.

virtual> <ebcdic2ascii
Last updated: Sat, 24 Mar 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites