<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.apache.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.apache-request-headers.php',
    1 => 'apache_request_headers',
    2 => '获取全部 HTTP 请求 header',
  ),
  'up' => 
  array (
    0 => 'ref.apache.php',
    1 => 'Apache 函数',
  ),
  'prev' => 
  array (
    0 => 'function.apache-note.php',
    1 => 'apache_note',
  ),
  'next' => 
  array (
    0 => 'function.apache-response-headers.php',
    1 => 'apache_response_headers',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/apache/functions/apache-request-headers.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.apache-request-headers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">apache_request_headers</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">apache_request_headers</span> &mdash; <span class="dc-title">获取全部 HTTP 请求 header</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.apache-request-headers-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>apache_request_headers</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   获取当前请求的所有请求 header。可在 Apache、FastCGI、CLI、FPM 模式下运行。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.apache-request-headers-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.apache-request-headers-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   当前请求中所有 HTTP header 的关联数组。
  </p>
 </div>


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

     </thead>

     <tbody class="tbody">
       <tr>
        <td>7.3.0</td>
        <td>
         此函数可用于 FPM SAPI 模式。
        </td>
       </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.apache-request-headers-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>apache_request_headers()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$headers </span><span style="color: #007700">= </span><span style="color: #0000BB">apache_request_headers</span><span style="color: #007700">();<br /><br />foreach (</span><span style="color: #0000BB">$headers </span><span style="color: #007700">as </span><span style="color: #0000BB">$header </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$value</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$header</span><span style="color: #DD0000">: </span><span style="color: #0000BB">$value</span><span style="color: #DD0000"> &lt;br /&gt;\n"</span><span style="color: #007700">;<br />}<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">Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0
Host: www.example.com
Connection: Keep-Alive</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.apache-request-headers-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    你也可以试图从环境变量中读取普通<abbr title="Common Gateway Interface">CGI</abbr>变量，PHP以<span class="productname">Apache</span>模块方式运行时有可能无法获得。使用<span class="function"><a href="function.phpinfo.php" class="function">phpinfo()</a></span>获得可读取的变量列表。
    <a href="language.variables.predefined.php" class="link">环境变量</a>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.apache-request-headers-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.apache-response-headers.php" class="function" rel="rdfs-seeAlso">apache_response_headers()</a> - 获得全部 HTTP 响应 header</span></li>
   </ul>
  </p>
 </div>

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