English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
array headers_list ( void )
The headers_list() function returns the list of HTTP headers ready to be sent to the browser/client. Check if headers have already been sent using headers_sent().
Returns the array of header indices.
<?php /* The setcookie() function will automatically add a response header */ setcookie('foo', 'bar'); /* Add custom response headers */ Most clients will ignore it actively */ header("X-Sample-Test: foo"); /* Specify plain text content in the response */ header('Content-type: text/plain'); /* What headers will be sent? */ var_dump(headers_list()); ?>
Output result:
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" }