Php input stream: example of sending an image to a server using input:
-
Submit the form to the server. the server uses file_get_contents to obtain the php: // input content:
- $ 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 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. |