From the official website, Php://input is a read-only information flow, when the request mode is post, and enctype not equal to "multipart/form-data", you can use Php://input to obtain the original requested data.
Look at a simple example.
The client is a form, very simple.
Copy Code code as follows:
<form action= "" method= "POST" >
Name: <input type= "text" name= "name" value= "Tom"/><br/>
Age:<input type= "text" name= "Age" value= "/><br"
<input type= "Submit" value= "Submit"/>
</form>
Submit the form to the server, and the server uses file_get_contents to get php://input content
Copy Code code as follows:
$content = file_get_contents ("Php://input");
Echo $content; Output name=tom&age=22
The official website about Php://input's note, repeatedly mentions $http_raw_post_data this variable, this variable actually and file_get_contents (php://input) content is the same. If you want to turn on this variable, you need to modify the configuration file, find the Always_populate_raw_post_data option, set to ON, and then restart the Web server. Using php://input does not require you to modify the PHP configuration file.
In the application of the project, such as camera photo, upload and save, you can use the php://input. After the client takes pictures, the picture is circulated to the server, the server uses file_get_getcontents (' Php://input ') to get the picture stream, and then the picture stream is saved to a file, this file is the picture.