ң

file_register_wrapper

( PHP 4 CVS)

file_register_wrapper - URL, PHP-.

boolean file_register_wrapper (string protocol, string classname)

:

1. base64
class Base64EncodingStream { var $fp = null; function stream_open($path, $mode, $options, &$opened_path) { $this->fp = fopen($path, $mode); return is_resource($this->fp); } function stream_close() { fclose($this->fp); } function stream_read($count) { return false; // We only allow writing } function stream_write($data) { return fwrite($this->fp, base64_encode($data)); } function stream_flush() { fflush($this->fp); return true; } function stream_seek($offset, $whence) { return false; } function stream_gets() { return false; } function stream_tell() { return false; } function stream_eof() { return false; } } file_register_wrapper("base64", "Base64EncodingStream") or die("Failed to register protocol"); copy("/tmp/inputfile.txt", "base64:///tmp/outputfile.txt"); readfile("/tmp/outputfile");

file_register_wrapper() false, protocol "fopen-" .

: PHP 4.3.0.


ң
file_get_wrapper_data file