Php input stream php: example of input usage (php sends images to the server ). 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 "multipartform-data", you can use php: to obtain the original information, see the official website. 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.
...