您当前的位置:首页 > 网站建设 > php
| php | asp | css | H5 | javascript | Mysql | Dreamweaver | Delphi | 网站维护 | 帝国cms | React | 考试系统 | ajax | jQuery |

PHP headers_list() 函数

51自学网 2023-01-07 20:36:20
  php

定义和用法

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

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

语法

headers_list()

提示和注释

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

实例 1

<?phpsetcookie("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 header() 函数
PHP headers_sent() 函数
51自学网,即我要自学网,自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1