Home Menu

headers_list

Returns a list of response headers sent (or ready to send)

Syntax

headers_list ( void ) : array

Return

Returns a numerically indexed array of headers.

Examples

1

<?

$return = headers_list();

print_r($return);

?>
Array
(
    [0] => X-Powered-By: PHP/8.0.3
)

2

<?

// specify plain text
header('Content-type: text/plain');

// define a custom response header - this will be ignored by most clients
header("X-Sample-Test: test");

// setcookie() will add a response header on its own
setcookie('test', 'stuff');

$return = headers_list();

print_r($return);

?>
Array
(
    [0] => X-Powered-By: PHP/8.0.3
    [1] => Content-type: text/plain;charset=UTF-8
    [2] => X-Sample-Test: test
    [3] => Set-Cookie: test=stuff
)

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms