downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.mb-output-handler.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.mbstring.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.mb-output-handler.php',
   
1 => 'mb_output_handler',
  ),
 
'up' =>
  array (
   
0 => 'ref.mbstring.php',
   
1 => 'Multibyte String Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.mb-list-encodings.php',
   
1 => 'mb_list_encodings',
  ),
 
'next' =>
  array (
   
0 => 'function.mb-parse-str.php',
   
1 => 'mb_parse_str',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<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>
  
 <a name="function.mb-output-handler.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><b>mb_output_handler</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$contents</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$status</tt></span>
   )</div>

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


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

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">contents</tt></i>
</span>

     </dt><dd class="listitem">

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

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">status</tt></i>
</span>

     </dt><dd class="listitem">

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

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

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


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

     </thead>

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

     </tbody>
   
   </table>
<p>
  </p>
 </div>


 <a name="function.mb-output-handler.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>mb_output_handler()</b> example</b></p>
    <div class="example-contents programlisting">
<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>
  </p>
 </div>


 <a name="function.mb-output-handler.notes"></a><div class="refsect1 notes">
  <h3 class="title">Notes</h3>
  <blockquote><p><b class="note">Note</b>:
  
    If you want to output some binary data such as image from PHP
    script with PHP 4.3.0 or later, Content-Type: header must be send
    using <a href="function.header.php" class="function">header()</a> before any binary data was send
    to client (e.g. header(&quot;Content-Type: image/png&quot;)).
    If Content-Type: header was send, output character encoding
    conversion will not be performed.
   <br />
  
    Note that if &#039;Content-Type: text/*&#039; was send using
    <a href="function.header.php" class="function">header()</a>, the sending data is regarded as text,
    encoding conversion will be performed using character encoding
    settings.
   <br />
  
    If you want to output some binary data such as image from PHP
    script with PHP 4.2.x or earlier, you must set output encoding to
    &quot;pass&quot; using <a href="function.mb-http-output.php" class="function">mb_http_output()</a>.
   <br />
  </p></blockquote>
 </div>

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


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites