<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.iconv.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.iconv-mime-decode.php',
    1 => 'iconv_mime_decode',
    2 => '解码一个MIME头字段',
  ),
  'up' => 
  array (
    0 => 'ref.iconv.php',
    1 => 'iconv 函数',
  ),
  'prev' => 
  array (
    0 => 'function.iconv-get-encoding.php',
    1 => 'iconv_get_encoding',
  ),
  'next' => 
  array (
    0 => 'function.iconv-mime-decode-headers.php',
    1 => 'iconv_mime_decode_headers',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/iconv/functions/iconv-mime-decode.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.iconv-mime-decode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">iconv_mime_decode</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">iconv_mime_decode</span> &mdash; <span class="dc-title">解码一个<code class="literal">MIME</code>头字段</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.iconv-mime-decode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>iconv_mime_decode</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = 0</span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   解码一个<code class="literal">MIME</code>头字段.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.iconv-mime-decode-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       编码头,是一个字符串.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">模式</code>决定了当<span class="function"><strong>iconv_mime_decode()</strong></span>遇到一个不规则的
       <code class="literal">MIME</code>头字段时,对这个事件作出的行为.你可以指定以下位掩码的任意组合.
       <table class="doctable table">
        <caption><strong>可以在<span class="function"><strong>iconv_mime_decode()</strong></span>中使用的位掩码</strong></caption>
        
         <thead>
          <tr>
           <th>值</th>
           <th>常量</th>
           <th>描述</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>1</td>
           <td>ICONV_MIME_DECODE_STRICT</td>
           <td>
            如果使用该位掩码,传入的头字段将会完全一致的按照<a href="https://datatracker.ietf.org/doc/html/rfc2047" class="link external">&raquo;&nbsp;RFC2047</a>的标准定义被解码.
            这个选项默认是禁用的,因为有很多零散的邮件用户代理商不遵守标准规范并且不生成正确的<code class="literal">MIME</code>头.
           </td>
          </tr>

          <tr>
           <td>2</td>
           <td>ICONV_MIME_DECODE_CONTINUE_ON_ERROR</td>
           <td>
            如果使用该位掩码,<span class="function"><a href="function.iconv-mime-decode-headers.php" class="function">iconv_mime_decode_headers()</a></span>
            将会试图忽略任何错误语法,并继续处理传入的头字段.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       可选的 <code class="parameter">encoding</code> 参数,用指定的字符集表示结果。如果省略或为
       <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>，<a href="iconv.configuration.php" class="link">iconv.internal_encoding</a>
       将会被默认使用。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.iconv-mime-decode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果解码成功,返回一个被解码的<code class="literal">MIME</code>字段,
   如果在解码过程中出现一个错误,将返回<strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> .
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.iconv-mime-decode-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">encoding</code> 现在可为 null。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.iconv-mime-decode-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>iconv_mime_decode()</strong></span>实例</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">//返回结果: "Subject: Prüfung Prüfung"<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">iconv_mime_decode</span><span style="color: #007700">(</span><span style="color: #DD0000">"Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?="</span><span style="color: #007700">,<br />                       </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">"ISO-8859-1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-function.iconv-mime-decode-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.iconv-mime-decode-headers.php" class="function" rel="rdfs-seeAlso">iconv_mime_decode_headers()</a> - 一次性解码多个 MIME 头字段</span></li>
    <li><span class="function"><a href="function.mb-decode-mimeheader.php" class="function" rel="rdfs-seeAlso">mb_decode_mimeheader()</a> - 解码 MIME 头字段中的字符串</span></li>
    <li><span class="function"><a href="function.imap-mime-header-decode.php" class="function" rel="rdfs-seeAlso">imap_mime_header_decode()</a> - Decode MIME header elements</span></li>
    <li><span class="function"><a href="function.imap-base64.php" class="function" rel="rdfs-seeAlso">imap_base64()</a> - Decode BASE64 encoded text</span></li>
    <li><span class="function"><a href="function.imap-qprint.php" class="function" rel="rdfs-seeAlso">imap_qprint()</a> - Convert a quoted-printable string to an 8 bit string</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>