array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.header-remove.php', 1 => 'header_remove', ), 'up' => array ( 0 => 'ref.network.php', 1 => '网络 函数', ), 'prev' => array ( 0 => 'function.header-register-callback.php', 1 => 'header_register_callback', ), 'next' => array ( 0 => 'function.header.php', 1 => 'header', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/network/functions/header-remove.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
header_remove — 删除之前设置的 HTTP 头
没有返回值。
版本 | 说明 |
---|---|
8.0.0 |
name 现在允许为 null。
|
示例 #1 取消指定的头
<?php
header("X-Foo: Bar");
header("X-Bar: Baz");
header_remove("X-Foo");
?>
以上示例的输出类似于:
X-Bar: Baz
示例 #2 取消之前全部指定的头
<?php
header("X-Foo: Bar");
header("X-Bar: Baz");
header_remove();
?>
以上示例的输出类似于:
本函数会删除所有 PHP 设置的头,
包括 Cookie、Session 和 X-Powered-By
。
注意:
数据头只会在SAPI支持时得到处理和输出。