array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.mailparse-uudecode-all.php', 1 => 'mailparse_uudecode_all', ), 'up' => array ( 0 => 'ref.mailparse.php', 1 => 'Mailparse 関数', ), 'prev' => array ( 0 => 'function.mailparse-stream-encode.php', 1 => 'mailparse_stream_encode', ), 'next' => array ( 0 => 'refs.math.php', 1 => '数学', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/mailparse/functions/mailparse-uudecode-all.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL mailparse >= 0.9.0)
mailparse_uudecode_all — ファイルポインタからデータをスキャンし、uuencode されたファイルを展開する
指定したファイルポインタからのデータを読み込み、 uuencode されたファイルを一時ファイルに展開します。
fp
有効なファイルポインタ。
ファイル名の情報を含む連想配列の配列を返します。
filename |
作成された一時ファイルへのパス。 |
origfilename |
もとのファイル名。uuencode されたパートにのみ存在します。 |
例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