PHP input and output streams are accessed through php://, which allows access to PHP's input and output streams, standard input and error descriptors, temporary file streams in memory, backup to disk, and filters that can manipulate other reads written to file resources.
Php://stdin, Php://stdout and Php://stderr.
Php://stdin,php://stdout and Php://stderr allow access to the corresponding input or output stream of the PHP process.
Php://input
Php://input is a read-only stream that can access the requested raw data. In the case of POST requests, it is best to use php://input instead of $HTTP _raw_post_data (native POST data) because it does not rely on specific php.ini directives and consumes less memory. The following example:
<formaction= "" method= "POST" >
<inputtype= "text" name= "test" ><inputtype= "Submit" Name= ""/>
</form>
<?php
Echo file_get_contents ("Php://input");
?>
Results:
Php://output
Php://output is a write-only data stream that allows you to write to the output buffer in the same way as print and echo.
Php://fd
PHP://FD allows direct access to the specified file descriptor. For example, PHP://FD/3 references a file descriptor of 3.
Php://memory and Php://temp
Php://memory and php://temp are a data flow similar to the file wrapper that allows temporary data to be read and written. The only difference is that php://memory always stores the data in memory, and php://temp in the temporary file after the amount of memory reaches a predefined limit (the default is 2MB). The location of the temporary file is determined in the same way as Sys_get_temp_dir ().
Php://filter
Php://filter is a meta wrapper designed for filtering and filtering applications when data flow is opened. This is useful for All-in-one (all-in-one) file functions, similar to ReadFile (), file (), and file_get_contents (), which have no opportunity to apply other filters before the data stream content is read. The parameters are as follows:
The following example:
<?php
/* This will output the entire contents of the http://www.phpcom.cn/in uppercase letters.
ReadFile ("php://filter/read=string.toupper/resource=http://www.phpcom.cn");
?>