<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.headers-list.php',
    1 => 'headers_list',
    2 => 'Retourne la liste des en-t&ecirc;tes de r&eacute;ponse du script courant',
  ),
  'up' => 
  array (
    0 => 'ref.network.php',
    1 => 'Fonctions r&eacute;seaux',
  ),
  'prev' => 
  array (
    0 => 'function.header-remove.php',
    1 => 'header_remove',
  ),
  'next' => 
  array (
    0 => 'function.headers-sent.php',
    1 => 'headers_sent',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/network/functions/headers-list.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.headers-list" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">headers_list</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">headers_list</span> &mdash; <span class="dc-title">Retourne la liste des en-têtes de réponse du script courant</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.headers-list-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>headers_list</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>headers_list()</strong></span> retourne un tableau avec la liste des en-têtes
   qui seront transmis au navigateur. Pour déterminer si ces en-têtes ont
   déjà été envoyés ou pas, utiliser la fonction <span class="function"><a href="function.headers-sent.php" class="function">headers_sent()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.headers-list-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">Cette fonction ne contient aucun paramètre.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.headers-list-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne un tableau d&#039;en-têtes indexé numériquement.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.headers-list-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>headers_list()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/* setcookie() va ajouter un en-tête */<br /></span><span style="color: #0000BB">setcookie</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">, </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Définit un en-tête de réponse<br />Il sera ignoré par la majorité des navigateurs */<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Example-Test: foo"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Spécification de la réponse en texte simple */<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type: text/plain; charset=UTF-8'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* Quels sont les en-têtes qui vont être envoyés ? */<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">headers_list</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Résultat de l&#039;exemple ci-dessus est similaire à :</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(4) {
  [0]=&gt;
  string(19) &quot;Set-Cookie: foo=bar&quot;
  [1]=&gt;
  string(17) &quot;Example-Test: foo&quot;
  [2]=&gt;
  string(39) &quot;Content-Type: text/plain; charset=UTF-8&quot;
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.headers-list-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
 <p class="para">
  Les en-têtes ne seront accessibles et s&#039;afficheront que lorsqu&#039;un SAPI qui les supporte sera utilisé.
 </p>
</p></blockquote>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.headers-list-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.headers-sent.php" class="function" rel="rdfs-seeAlso">headers_sent()</a> - Indique si les en-t&ecirc;tes HTTP ont d&eacute;j&agrave; &eacute;t&eacute; envoy&eacute;s</span></li>
    <li><span class="function"><a href="function.header.php" class="function" rel="rdfs-seeAlso">header()</a> - Envoie un en-t&ecirc;te HTTP brut</span></li>
    <li><span class="function"><a href="function.setcookie.php" class="function" rel="rdfs-seeAlso">setcookie()</a> - Envoie un cookie</span></li>
    <li><span class="function"><a href="function.apache-response-headers.php" class="function" rel="rdfs-seeAlso">apache_response_headers()</a> - R&eacute;cup&egrave;re tous les en-t&ecirc;tes de r&eacute;ponse HTTP</span></li>
    <li><span class="function"><a href="function.http-response-code.php" class="function" rel="rdfs-seeAlso">http_response_code()</a> - R&eacute;cup&egrave;re ou d&eacute;finit le code de r&eacute;ponse HTTP</span></li>
   </ul>
  </p>
 </div>


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