Home >Backend Development >PHP Tutorial >A brief analysis of the use of php input stream php://input, input stream input_PHP tutorial
When making a function to take pictures with a camera and then upload them, php://input is used in php to obtain the content. So I learned about php://input.
From the official website information, php://input is a read-only information flow. When the request method is post and enctype is not equal to "multipart/form-data", you can use php://input to obtain it. The original requested data.
Look at a simple example.
The client is just a form, very simple.
In project applications, such as taking pictures with the camera, uploading and saving, you can use php://input. After the client takes a photo, it sends the image stream to the server. The server uses file_get_getcontents('php://input') to get the image stream, and then saves the image stream to a file. This file is the image.
Reading the php input stream into a string is different from $_post and $_GET. Haha, for details, please see the manual
$content = file_get_contents("php://input");
file_put_contents('a.txt',$content);