Home >Backend Development >PHP Tutorial >PHP implementation to obtain the header sent to the user

PHP implementation to obtain the header sent to the user

*文
*文Original
2017-12-26 10:08:261385browse

How does PHP obtain the header sent to the user? This article mainly introduces the method of php to obtain the header information sent to the user, using the headers_list function in php. I hope to be helpful.

The example in this article describes how PHP obtains the header information sent to the user. Share it with everyone for your reference. The specific analysis is as follows:

The headers_list function has no parameters and returns an array. The returned array contains a numerical index table containing the header information to be sent to the client


<?php
  header("Expires: Sat, 12 Dec 1989 05:30:00 GMT");
  echo "This is some output.<br />";
  echo "Headers sent are:<br /> <UL>";
  $headers = headers_list();
  foreach($headers as $header) {
    echo "<LI>$header</LI>";
  }
  echo "</UL>";
?>

Related recommendations:

Several common URL address jump methods for PHP header

Some usage of PHP header function

PHP uses header to set browser cache

The above is the detailed content of PHP implementation to obtain the header sent to the user. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn