PHP headers_list() 函数

PHP 教程 · 2019-01-26 14:41:41

定义和用法

headers_list() 函数返回已发送的(或待发送的)响应头部的一个列表。

该函数返回包含报头的数组。

语法


headers_list()


提示和注释

提示:如需确定是否已发送报头,请使用 headers_sent() 函数。

实例 1


<?php
setcookie("TestCookie","SomeValue"');
header("X-Sample-Test: foo");
header('Content-type: text/plain');
?>
<html>
<body>
<?php
// What headers are to be sent?
var_dump(headers_list());
?>
</body>
</html>

上面的代码将输出:


array(4)
{
[0]=> string(23) "X-Powered-By: PHP/5.1.1"
[1]=> string(19) "Set-Cookie: TestCookie=SomeValue"
[2]=> string(18) "X-Sample-Test: foo"
[3]=> string(24) "Content-type: text/plain"
}


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Non-Obvious

Non-Obvious

Rohit Bhargava / Ideapress Publishing / 2015-3-29 / USD 24.95

What do Disney, Bollywood, and The Batkid teach us about how to create celebrity experiences for our audiences? How can a vending-machine inspire world peace? Can being imperfect make your business mo......一起来看看 《Non-Obvious》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具