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

查看所有标签

We Are the Nerds

We Are the Nerds

Christine Lagorio-Chafkin / Hachette Books / 2018-10-2 / USD 18.30

Reddit hails itself as "the front page of the Internet." It's the third most-visited website in the United States--and yet, millions of Americans have no idea what it is. We Are the Nerds is an eng......一起来看看 《We Are the Nerds》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试