或者,可以如下方式以靜態函數呼叫 uudecode()
$file =& Mail_mimeDecode::uudecode($some_text);
這將返回以下陣列
@param string 要在其中尋找附件的輸入主體
@return array 已解碼的主體、檔案名稱和權限
(PECL mailparse >= 0.9.0)
mailparse_uudecode_all — 掃描來自 fp 的資料並提取每個內嵌的 uuencoded 檔案
fp
一個有效的檔案指標。
返回一個關聯陣列的陣列,列出檔案名稱資訊。
filename |
建立的暫存檔案名稱的路徑 |
origfilename |
原始檔案名稱,僅適用於 uuencoded 部分 |
範例 #1 mailparse_uudecode_all() 範例
<?php
$text = <<<EOD
To: fred@example.com
hello, this is some text hello.
blah blah blah.
begin 644 test.txt
/=&AI<R!I<R!A('1E<W0*
`
end
EOD;
$fp = tmpfile();
fwrite($fp, $text);
$data = mailparse_uudecode_all($fp);
echo "BODY\n";
readfile($data[0]["filename"]);
echo "UUE ({$data[1]['origfilename']})\n";
readfile($data[1]["filename"]);
// 清理
unlink($data[0]["filename"]);
unlink($data[1]["filename"]);
?>
上述範例將輸出
BODY To: fred@example.com hello, this is some text hello. blah blah blah. UUE (test.txt) this is a test
或者,可以如下方式以靜態函數呼叫 uudecode()
$file =& Mail_mimeDecode::uudecode($some_text);
這將返回以下陣列
@param string 要在其中尋找附件的輸入主體
@return array 已解碼的主體、檔案名稱和權限