Differences between $ POST, $ HTTP_RAW_POST_DATA, and php: input $ POST
$ _ POST is the most commonly used method to obtain POST data. it organizes submitted data in the way of correlated arrays and performs encoding, such as urldecode and even encoding conversion, recognized data type is PHP default recognized data type application/x-www.form-urlencoded
HTTP_RAW_POST_DATA
As mentioned above, the default data Type recognized by PHP is application/x-www.form-urlencoded, with Content-Type = application/json Type, the submitted POST data can not be obtained at this time $ _ POST, however, you can obtain it using $ GLOBALS ['http _ RAW_POST_DATA. When PHP cannot identify Content-Type, it will fill in the POST data to $ HTTP_RAW_POST_DATA.
It takes effect only when the always_populate_raw_post_data value in php. ini is On.
When $ _ POST and php: // input can be obtained, $ HTTP_RAW_POST_DATA is empty.
It cannot be used for enctype = "multipart/form-data"
This global variable has been removed from php 7 and replaced with php: // input.
Php: // input
Php: // input: you can use the input stream to obtain raw POST data that has not been processed as a file, allowing you to read the original POST data. Compared with $ HTTP_RAW_POST_DATA, it puts less pressure on memory.
Summary
The above introduces three methods for obtaining POST data using PHP. we can use $ _ POST or PHP: // input to obtain POST data in the future. Although HTTP_RAW_POST_DATA can achieve the same purpose as php: // input, it will put a lot of pressure on the memory. the official team also noticed this problem, so in PHP7, the useless stuff is removed...