function.mb-encode-mimeheader.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 217 行

HTML
217
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Encode string for MIME header</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mb-detect-order.html">mb_detect_order</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-encode-numericentity.html">mb_encode_numericentity</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-encode-mimeheader" class="refentry"> <div class="refnamediv">  <h1 class="refname">mb_encode_mimeheader</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">mb_encode_mimeheader</span> &mdash; <span class="dc-title">Encode string for MIME header</span></p> </div>    <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">string</span> <span class="methodname"><b><b>mb_encode_mimeheader</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$str</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$charset</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$transfer_encoding</tt></span>   [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$linefeed</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$indent</tt></span>  ]]]] )</div>  <p class="para rdfs-comment">   Encodes a given <a href="language.types.string.html" class="type string">string</a>   <i><tt class="parameter">str</tt></i> by the MIME header encoding scheme.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">str</tt></i></span>     <dd>      <p class="para">       The <a href="language.types.string.html" class="type string">string</a> being encoded.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">charset</tt></i></span>     <dd>      <p class="para">       <i><tt class="parameter">charset</tt></i> specifies the name of the character set       in which <i><tt class="parameter">str</tt></i> is represented in. The default value       is determined by the current NLS setting (<i>mbstring.language</i>).      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">transfer_encoding</tt></i></span>     <dd>      <p class="para">       <i><tt class="parameter">transfer_encoding</tt></i> specifies the scheme of MIME       encoding. It should be either <i>&quot;B&quot;</i> (Base64) or       <i>&quot;Q&quot;</i> (Quoted-Printable). Falls back to       <i>&quot;B&quot;</i> if not given.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">linefeed</tt></i></span>     <dd>      <p class="para">       <i><tt class="parameter">linefeed</tt></i> specifies the EOL (end-of-line) marker       with which <b>mb_encode_mimeheader()</b> performs       line-folding (a <a href="http://www.faqs.org/rfcs/rfc2822" class="link external">&raquo; RFC</a> term,       the act of breaking a line longer than a certain length into multiple       lines. The length is currently hard-coded to 74 characters).       Falls back to <i>&quot;\r\n&quot;</i> (CRLF) if not given.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">indent</tt></i></span>     <dd>      <p class="para">             </p>     </dd>    </dt>   </dl>  </p> </div>  <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   A converted version of the <a href="language.types.string.html" class="type string">string</a> represented in ASCII.  </p> </div> <div class="refsect1 changelog">  <h3 class="title">ChangeLog</h3>  <p class="para">   <table class="informaltable">    <colgroup>     <thead valign="middle">      <tr valign="middle">       <th colspan="1">Version</th>       <th colspan="1">Description</th>      </tr>     </thead>     <tbody valign="middle" class="tbody">      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">5.0.0</td>       <td colspan="1" rowspan="1" align="left">        The <i><tt class="parameter">indent</tt></i> parameter was added.       </td>      </tr>     </tbody>    </colgroup>   </table>  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 <b>mb_encode_mimeheader()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$name&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;kanji<br /></span><span style="color: #0000BB">$mbox&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"kru"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$doma&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"gtinn.mon"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$addr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_encode_mimeheader</span><span style="color: #007700">(</span><span style="color: #0000BB">$name</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"UTF-7"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Q"</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;&lt;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$mbox&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"@"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$doma&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"&gt;"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">$addr</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div> <div class="refsect1 notes">  <h3 class="title">Notes</h3>  <blockquote><p><b class="note">Note</b>:        This function isn&#039;t designed to break lines at higher-level    contextual break points (word boundaries, etc.).    This behaviour may clutter up the original string with unexpected spaces.   <br />  </p></blockquote> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.mb-decode-mimeheader.html" class="function" rel="rdfs-seeAlso">mb_decode_mimeheader()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.mb-detect-order.html">mb_detect_order</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.mb-encode-numericentity.html">mb_encode_numericentity</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>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?