How to use headers_list() function to get a list of response headers sent in PHP

1 Answer

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

var_dump(headers_list());

   
/*
run: 

<html>
<head>

<body>

array(3) {
  [0]=>
  string(24) "X-Powered-By: PHP/5.4"
  [1]=>
  string(43) "Set-Cookie: DEBUGSESSID=1; path=/; version=1"
  [2]=>
  string(24) "Content-type: text/plain"
}


</body>
</html>

*/

 



answered May 10, 2016 by avibootz

Related questions

...