CakeFest 2024: The Official CakePHP Conference

mailparse_stream_encode

(PECL mailparse >= 0.9.0)

mailparse_stream_encode ソースファイルポインタからストリームデータを取得し、 エンコーディングを適用し、出力ファイルポインタに書き込む

説明

mailparse_stream_encode(resource $sourcefp, resource $destfp, string $encoding): bool

ソースファイルポインタからストリームデータを取得し、 encoding を適用して それを出力ファイルポインタに書き込みます。

パラメータ

sourcefp

有効なファイルハンドル。このファイルからのストリームがパーサに流し込まれます。

destfp

エンコードしたデータを書き込むファイルハンドル。

encoding

mbstring モジュールがサポートする文字エンコーディングのいずれか。

戻り値

成功した場合に true を、失敗した場合に false を返します。

例1 mailparse_stream_encode() の例

<?php

// email.eml の中身は: hello, this is some text=hello.
$fp = fopen('email.eml', 'r');

$dest = tmpfile();

mailparse_stream_encode($fp, $dest, "quoted-printable");

rewind($dest);

// ファイルの内容を表示します
fpassthru($dest);

?>

上の例の出力は以下となります。

hello, this is some text=3Dhello.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top