<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.network.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.header-remove.php',
    1 => 'header_remove',
    2 => '删除之前设置的 HTTP 头',
  ),
  'up' => 
  array (
    0 => 'ref.network.php',
    1 => '网络 函数',
  ),
  'prev' => 
  array (
    0 => 'function.header-register-callback.php',
    1 => 'header_register_callback',
  ),
  'next' => 
  array (
    0 => 'function.headers-list.php',
    1 => 'headers_list',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/network/functions/header-remove.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.header-remove" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">header_remove</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">header_remove</span> &mdash; <span class="dc-title">删除之前设置的 HTTP 头</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.header-remove-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>header_remove</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$name</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   删除之前用 <span class="function"><a href="function.header.php" class="function">header()</a></span> 设置的 HTTP 头。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.header-remove-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       要移除的头名称。当为 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，移除之前设置的所有 header。
      </p>
      <blockquote class="note"><p><strong class="note">注意</strong>: 
       <span class="simpara">
        参数不分大小写。
       </span>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.header-remove-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.header-remove-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">name</code> 现在允许为 null。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.header-remove-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 取消指定的头</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">"X-Foo: Bar"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"X-Bar: Baz"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header_remove</span><span style="color: #007700">(</span><span style="color: #DD0000">"X-Foo"</span><span style="color: #007700">); <br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">X-Bar: Baz</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>示例 #2 取消之前全部指定的头</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">"X-Foo: Bar"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"X-Bar: Baz"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">header_remove</span><span style="color: #007700">(); <br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode"></pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.header-remove-notes">
  <h3 class="title">注释</h3>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    本函数会删除<em>所有</em> PHP 设置的头，
    包括 Cookie、Session 和 <code class="literal">X-Powered-By</code>。
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
<p class="para">
 数据头只会在SAPI支持时得到处理和输出。
</p>
</p></blockquote>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.header-remove-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.header.php" class="function" rel="rdfs-seeAlso">header()</a> - 发送原生 HTTP 头</span></li>
    <li><span class="function"><a href="function.headers-sent.php" class="function" rel="rdfs-seeAlso">headers_sent()</a> - 检测消息头是否已经发送</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>