PHP input/output stream

Source: Internet
Author: User

Someone asked me about how to use PHP to transfer XML to PHPCHINA today ?, The corresponding solution is provided above. By the way, let's talk about PHP input and output streams.

During the summer vacation, when my colleagues used flash to create streaming media, they needed to use PHP to read the media information transmitted by FLASH (also in XML format ), at that time, I was familiar with the basic input/output stream principle of PHP.

The manual says:

PHP 3.0.13 and later versions. PHP: // output and php: // input are supported since php 4.3.0 and PHP: // filter is supported 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 stream of the PHP process.

Php: // output allows writing data to the output buffer mechanism, which is the same as print () and echo.

Php: // input allows reading original POST data. Compared with $ HTTP_RAW_POST_DATA, it puts less pressure on the memory and does not require any special php. ini settings. Php: // input cannot be used for enctype = "multipart/form-data ".

Php: // stdin and php: // input are read-only, while php: // stdout, php: // stderr and php: // output are only written.

Php: // filter is an encapsulation protocol designed to allow the filter program to flow when it is opened. This is useful for file functions with complete functions such as readfile (), file (), and file_get_contents (). Otherwise, you will not be able to apply the filter to the stream before reading the content.

That is to say, the original post data is saved in a file named php: // input. You can use simple file operations to read data.

$ Data = file_get_contents (php: // input );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.