Stream_Var supplies a class that can be used as a wrapper for PHP'' stream functions. This allows you to access variables with fopen(), fclose(), fwrite(), fread(), opendir() and all other filesystem functions.
You may use stream_wrapper_register() to register Stream_Var as a wrapper.
Scalar variables (strings, integers, floats) are treated as files, while arrays represent directories.
Please see the PHP Manual or the example for more information on how to register streams.
Stream_Var could be used in various scenarios. Imagine you are using a class that reads data from a file but you are creating the data on-the-fly and do not want to save the data before it can be processed by the class.
This is, where Stream_Var can be used. Just register it as a wrapper for fopen() and pass var://GLOBAL/yourVar as a parameter to the class.
It will read from the variable as if it was a file.
Пред. | Начало | След. |
Stream_Var | Уровень выше | Example |
HIVE: All information for read only. Please respect copyright! |