<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'outcontrol.examples.rewrite.php',
    1 => 'Verwendung des URL-Rewriters',
    2 => 'Verwendung des URL-Rewriters',
  ),
  'up' => 
  array (
    0 => 'outcontrol.examples.php',
    1 => 'Beispiele',
  ),
  'prev' => 
  array (
    0 => 'outcontrol.examples.basic.php',
    1 => 'Einsatzgrundlagen',
  ),
  'next' => 
  array (
    0 => 'ref.outcontrol.php',
    1 => 'Output-Control-Funktionen',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    '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">Verwendung des URL-Rewriters</h2>
  <p class="para">
   Von PHP 7.1.0 an verwenden <span class="function"><a href="function.output-add-rewrite-var.php" class="function">output_add_rewrite_var()</a></span> und
   <span class="function"><a href="function.output-reset-rewrite-vars.php" class="function">output_reset_rewrite_vars()</a></span> einen eigenen Ausgabepuffer,
   d. h. der <a href="session.configuration.php#ini.session.use-trans-sid" class="link">trans sid</a>
   Ausgabepuffer wird von diesen Funktionen nicht mehr verwendet.
  </p>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 URL-Rewriter-Beispiel</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">// Dieser Code funktioniert mit PHP 7.1.0, 7.0.10, 5.6.25 und höher.<br /><br />// HTTP_HOST ist der Standard-Zielhost. Wir setzen ihn händisch, damit das<br />// Beispiel funktioniert.<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">// Der URL-Rewriter soll nur form und a=href umschreiben.<br />// Elemente können durch tag_name=url_attr angegeben werden,<br />// z. B. img=src,iframe=src<br />// Zwischen diesen Angaben sind keine Leerzeichen erlaubt.<br />// Das Form-Element ist besonders, da ihm ein verstecktes Eingabefeld<br />// hinzugefügt wird.<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">// Dies wird zu URL und dem Form-Element hinzugefügt<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>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</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">
   Von PHP 7.1.0 haben die URL-Rewriter-Funktionen eigene INI Einstellungen:
   <a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.tags</a>
   und <a href="outcontrol.configuration.php#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a>.
  </p>
 </div><?php manual_footer($setup); ?>