Php input stream php: // analysis of input usage, input stream input_PHP tutorial

Source: Internet
Author: User
Php input stream: Analysis of input usage, input stream input. Php input stream: Analysis of input usage, input stream input is used to take a camera photo and then upload the function, php uses php: input to obtain the content. So I learned about php: input. Php input stream: // analysis of input, input stream input

In php, you can use php: // input to obtain the content after taking a camera photo and uploading it. So I learned about php: // input.

From the official website information, php: // input is a read-only information stream. when the request method is post and enctype is not equal to "multipart/form-data", you can use php: // input to obtain the data of the original request.

Let's look at a simple example.

The client is a form, which is very simple.

The code is as follows:




Submit the form to the server. the server uses file_get_contents to obtain the php: // input content.

The code is as follows:


$ Content = file_get_contents ("php: // input ");
Echo $ content; // Output name = tom & age = 22


The $ HTTP_RAW_POST_DATA variable is repeatedly mentioned in the php: // input description on the official website. The variable actually has the same content as file_get_contents (php: // input. To enable this variable, you need to modify the configuration file, find the always_populate_raw_post_data option, set it to On, and then restart the web server. Php: // input does not need to modify the php configuration file.

Php: // input can be used in project applications, such as camera photos, upload and save. After taking a photo from the client and sending the image to the server, the server can use file_getcontents ('php: // input') to get the image stream and save the image stream to a file, this file is an image.


Which of the following statements about file_get_contents ("php: // input") in php?

Read the php input stream to a string, which is different from $ _ post and $ _ GET. for details, see manual.

Save php: // input

$ Content = file_get_contents ("php: // input ");
File_put_contents('a.txt ', $ content );

Ghost is working on a camera to take a photo and then upload it. php: // input is used in php to obtain the content. So I learned about 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.