Home > Backend Development > PHP Tutorial > http://www.hunanzhibo.com/ Let's talk about PHP's input and output streams

http://www.hunanzhibo.com/ Let's talk about PHP's input and output streams

WBOY
Release: 2016-07-29 08:36:16
Original
1089 people have browsed it

Today someone asked me on PHPCHINA how to transfer XML from PHP? , and the corresponding solutions have been given above. By the way, let’s talk about PHP’s input and output streams.
When I was at the company during the summer vacation, my colleagues happened to be using Flash to create streaming media. They needed to use PHP to read the media information passed by FLASH (also in XML format). At that time, I was also familiar with the basic input and output stream principles of PHP.
The manual says:
PHP 3.0.13 and above, supports php://output and php://input since PHP 4.3.0, and supports php://filter since PHP 5.0.0.​
php://stdin
php://stdout
php://stderr
php://output
php://input
php://filter
php://stdin, php://stdout and php://stderr allow access to the corresponding input or output streams of the PHP process.​
php://output allows writing data to the output buffering mechanism in the same way as print() and echo().​
php://input allows reading the raw data of POST. It puts less pressure on memory than $HTTP_RAW_POST_DATA and does not require any special php.ini settings. php://input cannot be used with enctype="multipart/form-data".​
php://stdin and php://input are read-only, while php://stdout, php://stderr and php://output are write-only.​
php://filter is a wrapper protocol designed to allow filter programs to become streams when opened. This is useful for file functions such as readfile(), file() and file_get_contents() that have full functionality on their own, as otherwise there would be no opportunity to apply filters on top of the stream before reading the contents.​
In other words, the original data of the post is saved in a file called php://input. You can control it by reading the data inside through simple file operations.
$data=file_get_contents(php://input);

The above introduces http://www.hunanzhibo.com/ and talks about the input and output streams of PHP, including the content of http://www.hunanzhibo.com/. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template