Change language

PHP Headers_list () function

Syntax:
array headers_list (void)
Parameters:This function takes no parameters. 
Return value:returns a list or array of headers to send to the browser or client.Note:this is different from the headers_sent() function, which is fine for checking if a header is sent or not, but headers_list() is not auspicious in this context as it lists both sent and ready-to-send headers states.Example 1: < tbody>  
// Use the setcookie() function to add
// response header setcookie ( "cookie1" , "value_of_cookie1" );  
// Define the title header ( "test: engineerforengineer" ); header ( " Content-type: text / plain " );  
// Show array returned
// headers_list() function
print_r (headers_list());  
?>
Output:
Array ([0] = > Set-Cookie: cookie1 = value_of_cookie1 [1] = > test: engineerforengineer [2] = > Content-type: text / plain; charset = UTF-8)  Example 2:        
// Use the setcookie() function to add
// title automatically setcookie ( ’uid’ , ’user4059’ );  
// Define a custom response header header ( "custom-res-header: cstm" );  
// Specify plain text content in // response header ( ’Content-type: text / plain’ );  
// Show all submitted headers
var_dump (headers_list());  
?>
Output:
array (3) {[0] = > string (24) "Set-Cookie: uid = user4059" [1] = > string (23) "custom-res-header: cstm" [2] = > string (38) "Content-type: text / plain; charset = UTF-8"}
Link: http://php.net/manual/en/function.headers-list.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method