PHP - imap_utf8() 函式



PHP−IMAP 函式可幫助您訪問電子郵件帳戶,IMAP 代表Internet Mail Access Protocol,使用這些函式您還可以使用 NNTP、POP3 協議和本地郵箱訪問方法。

imap_utf8() 函式接受 MIME 編碼字串作為引數並將其解碼為 UTF-8。

語法

imap_utf8($txt);

引數

序號 引數和描述
1

txt(必填)

這是一個字串值,表示 MIME 編碼字串。

返回值

此函式返回一個字串值,其中包含給定字串的 UTF-8 值。

PHP 版本

此函式首次在 PHP 版本 4 中引入,並在所有後續版本中均有效。

示例

以下示例演示了imap_utf8() 函式的使用。

<html>
   <body>
      <?php
         $mime_encoded = 'example: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=';
         $res = imap_utf8($mime_encoded);
         print($res);
         print("<br>");
		
         $mime_encoded = 'test =?ISO-8859-1?Q?Schl=FCter?=';
         $res = imap_utf8($mime_encoded);
         print($res);
      ?>
   </body>
</html>

輸出

這將生成以下輸出:

example: Prüfung Prüfung
test Schlüter
php_function_reference.htm
廣告