PHP 教程 PHP 表单 PHP 高级教程 PHP 数据库 PHP XML PHP 与 AJAX PHP 参考手册

发布于 2016-11-18 14:29:58 | 89 次阅读 | 评论: 0 | 来源: 网络整理


定义和用法

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"
 } 


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务