uTools-Manuals/docs/php/imap_mime_header_decode.html
2019-04-28 19:00:34 +08:00

102 lines
5.3 KiB
HTML

<!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>Decode MIME header elements</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.imap-mime-header-decode" class="refentry">
<div class="refnamediv">
<h1 class="refname">imap_mime_header_decode</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imap_mime_header_decode</span> &mdash; <span class="dc-title">Decode MIME header elements</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.imap-mime-header-decode-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>imap_mime_header_decode</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$text</code></span>
) : <span class="type">array</span></div>
<p class="para rdfs-comment">
Decodes MIME message header extensions that are non ASCII text (see <a href="http://www.faqs.org/rfcs/rfc2047" class="link external">&raquo;&nbsp;RFC2047</a>).
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.imap-mime-header-decode-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">text</code></dt>
<dd>
<p class="para">
The MIME text
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.imap-mime-header-decode-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
The decoded elements are returned in an array of objects, where each
object has two properties, <em>charset</em> and
<em>text</em>.
</p>
<p class="para">
If the element hasn&#039;t been encoded, and in other words is in
plain US-ASCII, the <em>charset</em> property of that element is
set to <em>default</em>.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.imap-mime-header-decode-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4029">
<p><strong>Example #1 <span class="function"><strong>imap_mime_header_decode()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?=&nbsp;&lt;keld@example.com&gt;"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$elements&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_mime_header_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br />for&nbsp;(</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$elements</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Charset:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">$elements</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]-&gt;</span><span style="color: #0000BB">charset</span><span style="color: #007700">}</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Text:&nbsp;</span><span style="color: #007700">{</span><span style="color: #0000BB">$elements</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]-&gt;</span><span style="color: #0000BB">text</span><span style="color: #007700">}</span><span style="color: #DD0000">\n\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
Charset: ISO-8859-1
Text: Keld Jørn Simonsen
Charset: default
Text: &lt;keld@example.com&gt;
</pre></div>
</div>
</div>
</p>
<p class="para">
In the above example we would have two elements, whereas the first
element had previously been encoded with ISO-8859-1, and the second
element would be plain US-ASCII.
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.imap-mime-header-decode-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="imap_utf8.html" class="function" rel="rdfs-seeAlso">imap_utf8()</a> - Converts MIME-encoded text to UTF-8</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>