(no version information, might be only in CVS)
php_stream_make_seekable()
checks if origstream is
seekable. If it is not, it will copy the data into a new
temporary stream. If successful,
newstream is always set to the stream that is valid
to use, even if the original stream was seekable.
flags allows you to
specify your preference for the seekeable stream that is
returned: use
PHP_STREAM_NO_PREFERENCE to use the default seekable
stream (which uses a dynamically expanding memory buffer, but
switches to temporary file backed storage when the stream
size becomes large), or use
PHP_STREAM_PREFER_STDIO to use "regular" temporary
file backed storage.
表格 43-1.
php_stream_make_seekable() return values
注: If you need to seek and write to the stream, it does not make sense to use this function, because the stream it returns is not guaranteed to be bound to the same resource as the original stream.
注: If you only need to seek forwards, there is no need to call this function, as the streams API will emulate forward seeks when the whence parameter is SEEK_CUR.
注: If origstream is network based, this function will block until the whole contents have been downloaded.
注: NEVER call this function with an origstream that is reference by a file pointer in a PHP script! This function may cause the underlying stream to be closed which could cause a crash when the script next accesses the file pointer!
注: In many cases, this function can only succeed when origstream is a newly opened stream with no data buffered in the stream layer. For that reason, and because this function is complicated to use correctly, it is recommended that you use php_stream_open_wrapper() and pass in PHP_STREAM_MUST_SEEK in your options instead of calling this function directly.