Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 4201

php-manual-en-5.5.7-1.mga4.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>Callback function converts character encoding in output buffer</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-list-encodings.html">mb_list_encodings</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-parse-str.html">mb_parse_str</a></div>
 <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.mb-output-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_output_handler</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">mb_output_handler</span> &mdash; <span class="dc-title">Callback function converts character encoding in output buffer</span></p>
 
 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-output-handler-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>mb_output_handler</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$contents</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$status</code></span>
   )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>mb_output_handler()</strong></span> is
    <span class="function"><a href="function.ob-start.html" class="function">ob_start()</a></span> callback
   function.  <span class="function"><strong>mb_output_handler()</strong></span> converts
   characters in the output buffer from internal character encoding to
   HTTP output character encoding. 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-output-handler-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">contents</code></em></span>
     <dd>

      <p class="para">
       The contents of the output buffer.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">status</code></em></span>
     <dd>

      <p class="para">
       The status of the output buffer.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.mb-output-handler-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The converted <span class="type"><a href="language.types.string.html" class="type string">string</a></span>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.mb-output-handler-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.1.0</td>
       <td>
        <p class="para">
         This handler now adds the charset HTTP header when the following conditions are met:
        </p>
        <p class="para">
         <ul class="itemizedlist">
          <li class="listitem">
           <span class="simpara">
            <em>Content-Type</em> has not been set, using  <span class="function"><a href="function.header.html" class="function">header()</a></span>.
           </span>
          </li>
          <li class="listitem">
           <span class="simpara">
            The default MIME type begins with <em>text/</em>.
           </span>
          </li>
          <li class="listitem">
           <span class="simpara">
            The <a href="mbstring.configuration.html#ini.mbstring.http-input" class="link">mbstring.http_input</a> 
            setting is something other than <em>pass</em>.
           </span>
          </li>
         </ul>
        </p>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-output-handler-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2716">
    <p><strong>Example #1  <span class="function"><strong>mb_output_handler()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />mb_http_output</span><span style="color: #007700">(</span><span style="color: #DD0000">"UTF-8"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ob_start</span><span style="color: #007700">(</span><span style="color: #DD0000">"mb_output_handler"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.mb-output-handler-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If you want to output binary data, such as an image, using PHP 4.3.0 or later,
    a Content-Type: header must be set using  <span class="function"><a href="function.header.html" class="function">header()</a></span> 
    before any binary data is sent to the client (e.g. header(&quot;Content-Type: image/png&quot;)).
    If Content-Type: header is sent, output character encoding conversion will not be performed.
   </p>
   <p class="para">
    Note that if &#039;Content-Type: text/*&#039; is sent, the content body is regarded as text; conversion will take place.
   </p>
   <p class="para">
    If you want to output binary data, such as an image, using PHP 4.2.x or earlier, 
    you must set output encoding to &quot;pass&quot; using  <span class="function"><a href="function.mb-http-output.html" class="function">mb_http_output()</a></span>.
   </p>
  </p></blockquote>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.mb-output-handler-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.ob-start.html" class="function" rel="rdfs-seeAlso">ob_start()</a> - Turn on output buffering</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-list-encodings.html">mb_list_encodings</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-parse-str.html">mb_parse_str</a></div>
 <div class="up"><a href="ref.mbstring.html">Multibyte String Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>