Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP headers_list() Function

PHP headers_list() Function


PHP HTTP Reference Manual Complete PHP HTTP Reference Manual


Definition and Usage

The headers_list() function returns a list of response headers that have been sent (or are ready to be sent).

This function returns an array containing the headers.

Syntax

headers_list()


Tips and Notes

**Tip:** To determine whether headers have been sent, use the headers_sent() function.


Example 1

The code above will output:

array(4)

{

[0]=> string(23) "X-Powered-By: PHP/5.1.1"

[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"

[2]=> string(18) "X-Sample-Test: foo"

[3]=> string(24) "Content-type: text/plain"

}


PHP HTTP Reference Manual Complete PHP HTTP Reference Manual