<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/outcontrol.examples.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'outcontrol.examples.rewrite.php',
    1 => 'Utilisation de la r&eacute;&eacute;criture de sortie',
    2 => 'Utilisation de la r&eacute;&eacute;criture de sortie',
  ),
  'up' => 
  array (
    0 => 'outcontrol.examples.php',
    1 => 'Exemples',
  ),
  'prev' => 
  array (
    0 => 'outcontrol.examples.basic.php',
    1 => 'Utilisation simple',
  ),
  'next' => 
  array (
    0 => 'ref.outcontrol.php',
    1 => 'Fonctions de bufferisation de sortie',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/outcontrol/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="outcontrol.examples.rewrite" class="section">
  <h2 class="title">Utilisation de la réécriture de sortie</h2>
  <p class="para">
   À partir de PHP 7.1.0, <span class="function"><a href="function.output-add-rewrite-var.php" class="function">output_add_rewrite_var()</a></span>, <span class="function"><a href="function.output-reset-rewrite-vars.php" class="function">output_reset_rewrite_vars()</a></span> utilisent un tampon de sortie dédié. C&#039;est-à-dire qu&#039;elles n&#039;utilisent pas de tampon de sortie <a href="session.configuration.php#ini.session.use-trans-sid" class="link">trans sid</a>.
  </p>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple de réécriture de la sortie</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Ce code fonctionne avec PHP 7.1.0, 7.0.10, 5.6.25 et supérieur.<br /><br />// HTTP_HOST est l'hôte cible par défaut. Définir manuellement pour que l'exemple de code fonctionne.<br /></span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'HTTP_HOST'</span><span style="color: #007700">] = </span><span style="color: #DD0000">'php.net'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// La réécriture de la sortie ne peut réécrire que les formulaires. Ajouter a=href.<br />// Les balises peuvent être spécifiées tag_name=url_attr, par ex. img=src,iframe=src<br />// Aucun espace autorisé entre les paramètres.<br />// La balise form est une balise spéciale qui ajoute un champ caché.<br /></span><span style="color: #0000BB">ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'url_rewriter.tags'</span><span style="color: #007700">,</span><span style="color: #DD0000">'a=href,form='</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">ini_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'url_rewriter.tags'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">// Ceci est ajouté à l'URL et au formulaire<br /></span><span style="color: #0000BB">output_add_rewrite_var</span><span style="color: #007700">(</span><span style="color: #DD0000">'test'</span><span style="color: #007700">, </span><span style="color: #DD0000">'value'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;a href="//php.net/index.php?bug=1234"&gt;bug1234&lt;/a&gt;<br />&lt;form action="https://php.net/?bug=1234&amp;edit=1" method="post"&gt;<br /> &lt;input type="text" name="title" /&gt;<br />&lt;/form&gt;</span></code></div>
    </div>

    <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
&lt;a href=&quot;//php.net/?bug=1234&amp;test=value&quot;&gt;bug1234&lt;/a&gt;
&lt;form action=&quot;https://php.net/?bug=1234&amp;edit=1&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;test&quot; value=&quot;value&quot; /&gt;
 &lt;input type=&quot;text&quot; name=&quot;title&quot; /&gt;
&lt;/form&gt;
</pre></div>
    </div>
   </div>
  </p>
  <p class="para">
   À partir de PHP 7.1.0, les fonctions de réécriture de sortie ont leurs propres paramètres INI, <a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.tags</a> et <a href="outcontrol.configuration.php#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a>.
  </p>
 </div><?php manual_footer($setup); ?>