mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 15:28:55 +00:00
91 lines
2.1 KiB
XML
91 lines
2.1 KiB
XML
![]() |
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
<!-- $Revision: 1.1 $ -->
|
||
|
<refentry id="function.headers-list">
|
||
|
<refnamediv>
|
||
|
<refname>headers_list</refname>
|
||
|
<refpurpose>Returns a list of response headers sent (or ready to send)</refpurpose>
|
||
|
</refnamediv>
|
||
|
<refsect1>
|
||
|
<title>Description</title>
|
||
|
<methodsynopsis>
|
||
|
<type>array</type><methodname>headers_list</methodname>
|
||
|
<void/>
|
||
|
</methodsynopsis>
|
||
|
<simpara>
|
||
|
<function>headers_list</function> will return a numerically indexed array
|
||
|
of headers to be sent to the browser / client. To determine whether or not
|
||
|
these headers have been sent yet, use <function>headers_sent</function>.
|
||
|
</simpara>
|
||
|
<para>
|
||
|
<example>
|
||
|
<title>Examples using <function>headers_list</function></title>
|
||
|
<programlisting role="php">
|
||
|
<![CDATA[
|
||
|
<?php
|
||
|
|
||
|
/* setcookie() will add a response header on its own */
|
||
|
setcookie('foo', 'bar');
|
||
|
|
||
|
/* Define a custom response header
|
||
|
This will be ignored by most clients */
|
||
|
header("X-Sample-Test: foo");
|
||
|
|
||
|
/* Specify plain text content in our response */
|
||
|
header('Content-type: text/plain');
|
||
|
|
||
|
/* What headers are going to be sent? */
|
||
|
var_dump(headers_list());
|
||
|
|
||
|
?>
|
||
|
]]>
|
||
|
</programlisting>
|
||
|
<para>
|
||
|
this will output :
|
||
|
</para>
|
||
|
<screen>
|
||
|
<![CDATA[
|
||
|
array(4) {
|
||
|
[0]=>
|
||
|
string(23) "X-Powered-By: PHP/5.1.3"
|
||
|
[1]=>
|
||
|
string(19) "Set-Cookie: foo=bar"
|
||
|
[2]=>
|
||
|
string(18) "X-Sample-Test: foo"
|
||
|
[3]=>
|
||
|
string(24) "Content-type: text/plain"
|
||
|
}
|
||
|
|
||
|
]]>
|
||
|
</screen>
|
||
|
</example>
|
||
|
</para>
|
||
|
<simpara>
|
||
|
See Also:
|
||
|
<function>headers_sent</function>,
|
||
|
<function>header</function>, and
|
||
|
<function>setcookie</function>.
|
||
|
</simpara>
|
||
|
</refsect1>
|
||
|
</refentry>
|
||
|
|
||
|
<!-- Keep this comment at the end of the file
|
||
|
Local variables:
|
||
|
mode: sgml
|
||
|
sgml-omittag:t
|
||
|
sgml-shorttag:t
|
||
|
sgml-minimize-attributes:nil
|
||
|
sgml-always-quote-attributes:t
|
||
|
sgml-indent-step:1
|
||
|
sgml-indent-data:t
|
||
|
indent-tabs-mode:nil
|
||
|
sgml-parent-document:nil
|
||
|
sgml-default-dtd-file:"../../../../manual.ced"
|
||
|
sgml-exposed-tags:nil
|
||
|
sgml-local-catalogs:nil
|
||
|
sgml-local-ecat-files:nil
|
||
|
End:
|
||
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
|
vim: et tw=78 syn=sgml
|
||
|
vi: ts=1 sw=1
|
||
|
-->
|