PHP 入出力 ストリーム

PHP 3.0.13以降、php://output 、そして、 PHP 4.3以降、php://input

php://stdinphp://stdoutphp://stderr により、対応するPHPプロセスの 入力または出力ストリームにアクセスできるようになります。

php://output により、 print() およびecho()と同様の 手法により、出力バッファに書き込むことができるようになります。

php://input により、raw POSTデータを読み込む ことができるようになります。これは、 $HTTP_RAW_POST_DATAよりメモリ消費量が少なく、 代わりとなるものです。また、特別なphp.iniディレクティブを全く必 要としません。

php://stdin および php://input は読み込みのみ可です。一方、 php://stdout, php://stderr および php://output は、書き込みのみ可です。

php://filter is a kind of meta-wrapper designed to permit the application of filters to a stream at the time of opening. This is useful with all-in-one file functions such as readfile(), file(), and file_get_contents() where there is otherwise no opporotunity to apply a filter to the stream prior the contents being read.

The php://filter target takes the following 'parameters' as parts of its 'path'.

表 L-5. Wrapper Summary (For php://filter, refer to summary of wrapper being filtered.)

AttributeSupported
Restricted by allow_url_fopen.No
Allows Reading php://stdin and php://input only.
Allows Writing php://stdout, php://stderr, and php://output only.
Allows Appending php://stdout, php://stderr, and php://output only. (Equivalent to writing)
Allows Simultaneous Reading and WritingNo. These wrappers are unidirectional.
Supports stat()No
Supports unlink()No