Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 11100

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Output rewrite usage</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="outcontrol.examples.basic.html">Basic usage</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.outcontrol.html">Output Control Functions</a></div>
 <div class="up"><a href="outcontrol.examples.html">Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="outcontrol.examples.rewrite" class="section">
  <h2 class="title">Output rewrite usage</h2>
  <p class="para">
   Since PHP 7.1.0, <span class="function"><a href="function.output-add-rewrite-var.html" class="function">output_add_rewrite_var()</a></span>, <span class="function"><a href="function.output-reset-rewrite-vars.html" class="function">output_reset_rewrite_vars()</a></span> use dedicated output buffer. i.e. It does not use <a href="session.configuration.html#ini.session.use-trans-sid" class="link">trans sid</a> output buffer. 
  </p>
  <p class="para">
   <div class="example" id="example-506">
    <p><strong>Example #1 Output rewrite example</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">//&nbsp;This&nbsp;code&nbsp;works&nbsp;with&nbsp;PHP&nbsp;7.1.0,&nbsp;7.0.10,&nbsp;5.6.25&nbsp;and&nbsp;up.<br /><br />//&nbsp;HTTP_HOST&nbsp;is&nbsp;default&nbsp;target&nbsp;host.&nbsp;Set&nbsp;manually&nbsp;to&nbsp;make&nbsp;sample&nbsp;code&nbsp;works.<br /></span><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</span><span style="color: #DD0000">'HTTP_HOST'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'php.net'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;Output&nbsp;rewriter&nbsp;only&nbsp;rewrite&nbsp;form.&nbsp;Add&nbsp;a=href.<br />//&nbsp;Tags&nbsp;can&nbsp;be&nbsp;specified&nbsp;tag_name=url_attr,&nbsp;e.g.&nbsp;img=src,iframe=src<br />//&nbsp;No&nbsp;space&nbsp;allowed&nbsp;between&nbsp;settings.<br />//&nbsp;Form&nbsp;tag&nbsp;is&nbsp;special&nbsp;tag&nbsp;that&nbsp;add&nbsp;hidden&nbsp;input.<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">//&nbsp;This&nbsp;is&nbsp;added&nbsp;to&nbsp;URL&nbsp;and&nbsp;form<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">,&nbsp;</span><span style="color: #DD0000">'value'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;<br /></span>&lt;a&nbsp;href="//php.net/index.php?bug=1234"&gt;bug1234&lt;/a&gt;<br />&lt;form&nbsp;action="https://php.net/?bug=1234&amp;edit=1"&nbsp;action="post"&gt;<br />&nbsp;&lt;input&nbsp;type="text"&nbsp;name="title"&nbsp;/&gt;<br />&lt;/form&gt;</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</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">
   Since PHP 7.1.0, output rewrite functions have it&#039;s own INI settings, <a href="outcontrol.configuration.html#ini.url-rewriter.tags" class="link">url_rewriter.tags</a> and <a href="outcontrol.configuration.html#ini.url-rewriter.hosts" class="link">url_rewriter.hosts</a>. 
  </p>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="outcontrol.examples.basic.html">Basic usage</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.outcontrol.html">Output Control Functions</a></div>
 <div class="up"><a href="outcontrol.examples.html">Examples</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>