Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the php input stream php://input

Shulou Source: shulou.com Published: 2022-06-03 07:43:44 11月15日 Update

This article introduces the knowledge of "how to use php input stream php://input". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

Name:

Age:

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

The copy code is as follows:

$content = file_get_contents ("php://input")

Echo $content; / / output name=tom&age=22

The description of php://input on the official website repeatedly mentions the variable $HTTP_RAW_POST_DATA, which is actually the same as file_get_contents (php://input). If you want to turn on 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. Using php://input does not require modification of the php configuration file.

Php://input can be used in project applications, such as taking photos with camera, uploading and saving. After the client takes a picture, the picture stream is sent to the server, and the server uses file_get_getcontents ('php://input') to get the picture stream, and then save the picture stream to a file, which is the picture.

This is the end of "how to use the php input stream php://input". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Services code content pictures files variables input more knowledge output configuration practical learned and then dilemma actual client client that is the situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi macOS MySQL Redmi OPPO Reno