<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.outcontrol.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.output-add-rewrite-var.php',
    1 => 'output_add_rewrite_var',
    2 => 'Add URL rewriter values',
  ),
  'up' => 
  array (
    0 => 'ref.outcontrol.php',
    1 => 'Функції Контроля Виводу',
  ),
  'prev' => 
  array (
    0 => 'function.ob-start.php',
    1 => 'ob_start',
  ),
  'next' => 
  array (
    0 => 'function.output-reset-rewrite-vars.php',
    1 => 'output_reset_rewrite_vars',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/outcontrol/functions/output-add-rewrite-var.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.output-add-rewrite-var" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">output_add_rewrite_var</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">output_add_rewrite_var</span> &mdash; <span class="dc-title">Add URL rewriter values</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.output-add-rewrite-var-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>output_add_rewrite_var</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   This function starts the <code class="literal">&#039;URL-Rewriter&#039;</code> output buffer handler
   if it is not active,
   stores the <code class="parameter">name</code> and <code class="parameter">value</code> parameters,
   and when the buffer is flushed rewrites the <abbr title="Uniform Resource Locator">URL</abbr>s
   and forms based on the applicable ini settings.
   Subsequent calls to this function will store all additional name/value pairs
   until the handler is turned off.
  </p>
  <p class="para">
   When the output buffer is flushed
   (by calling <span class="function"><a href="function.ob-flush.php" class="function">ob_flush()</a></span>, <span class="function"><a href="function.ob-end-flush.php" class="function">ob_end_flush()</a></span>,
   <span class="function"><a href="function.ob-get-flush.php" class="function">ob_get_flush()</a></span> or at the end of the script)
   the <code class="literal">&#039;URL-Rewriter&#039;</code> handler adds the name/value pairs
   as query parameters to <abbr title="Uniform Resource Locator">URL</abbr>s in attributes of HTML tags
   and adds hidden fields to forms based on the values of the
   <a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.tags</a> and
   <a href="outcontrol.configuration.php#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a>
   configuration directives.
  </p>
  <p class="para">
   Each name/value pair added to the <code class="literal">&#039;URL-Rewriter&#039;</code> handler
   is added to the <abbr title="Uniform Resource Locator">URL</abbr>s and/or forms
   even if this results in duplicate <abbr title="Uniform Resource Locator">URL</abbr> query parameters
   or elements with the same name attributes.
  </p>
  <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
   <span class="simpara">
    Once the <code class="literal">&#039;URL-Rewriter&#039;</code> handler has been turned off
    it cannot be started again.
   </span>
  </p></blockquote>
  <div class="warning"><strong class="warning">Увага</strong>
   <p class="simpara">
    Prior to PHP 8.4.0, the hosts to be rewritten were set in
    <a href="session.configuration.php#ini.session.trans-sid-hosts" class="link">session.trans_sid_hosts</a>
    instead of <a href="outcontrol.configuration.php#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a>.
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.output-add-rewrite-var-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       The variable name.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The variable value.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.output-add-rewrite-var-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.output-add-rewrite-var-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.1.0</td>
       <td>
        As of PHP 7.1.0, a dedicated output buffer is used,
        <a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.tags</a>
        is used solely for output functions and
        <a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.hosts</a> is available.
        Prior to PHP 7.1.0, rewrite variables set by <span class="function"><strong>output_add_rewrite_var()</strong></span>
        shared an output buffer with transparent session id support
        (see <a href="session.configuration.php#ini.session.trans-sid-tags" class="link">session.trans_sid_tags</a>).
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.output-add-rewrite-var-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>output_add_rewrite_var()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />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 /><br /></span><span style="color: #0000BB">output_add_rewrite_var</span><span style="color: #007700">(</span><span style="color: #DD0000">'var'</span><span style="color: #007700">, </span><span style="color: #DD0000">'value'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// some links<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">'&lt;a href="file.php"&gt;link&lt;/a&gt;<br />&lt;a href="http://example.com"&gt;link2&lt;/a&gt;'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// a form<br /></span><span style="color: #007700">echo </span><span style="color: #DD0000">'&lt;form action="script.php" method="post"&gt;<br />&lt;input type="text" name="var2" /&gt;<br />&lt;/form&gt;'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">ob_list_handlers</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">&lt;a href=&quot;file.php?var=value&quot;&gt;link&lt;/a&gt;
&lt;a href=&quot;http://example.com&quot;&gt;link2&lt;/a&gt;

&lt;form action=&quot;script.php&quot; method=&quot;post&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;var&quot; value=&quot;value&quot; /&gt;
&lt;input type=&quot;text&quot; name=&quot;var2&quot; /&gt;
&lt;/form&gt;

Array
(
    [0] =&gt; URL-Rewriter
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.output-add-rewrite-var-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.output-reset-rewrite-vars.php" class="function" rel="rdfs-seeAlso">output_reset_rewrite_vars()</a> - Reset URL rewriter values</span></li>
    <li><span class="function"><a href="function.ob-flush.php" class="function" rel="rdfs-seeAlso">ob_flush()</a> - Flush (send) the return value of the active output handler</span></li>
    <li><span class="function"><a href="function.ob-list-handlers.php" class="function" rel="rdfs-seeAlso">ob_list_handlers()</a> - List all output handlers in use</span></li>
    <li><a href="outcontrol.configuration.php#ini.url-rewriter.tags" class="link">url_rewriter.tags</a></li>
    <li><a href="outcontrol.configuration.php#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a></li>
   </ul>
  </p>
 </div>


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