English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
array headers_list(void)
headers_list() will return the HTTP response headers (or those ready to be sent) to the browser/Client HTTP header list. Check if these headers have been sent using headers_sent().
Returns an array of header indices.
<?php /* setcookie() will automatically add a response header */ setcookie('foo', 'bar'); /* Add custom response headers Most clients will ignore this header automatically */ header("X-Sample-Test: foo /* Specify plain text content in the response text */ header('Content-type: text/plain'); /* So what headers will be sent? */ var_dump(headers_list()); ?>
Output result:
array(4) { [0]=> string(23) X-Powered-By: PHP/5.1.3 [1return string(19) Set-Cookie: foo=bar" [2return string(18) X-Sample-Test: foo" [3return string(24) Content-type: text/plain" }