Differences between $ POST, $ HTTP_RAW_POST_DATA, and php: input
$ POST, $ HTTP_RAW_POST_DATA, and php: // differences between input
Always generate variables that contain original POST data. Otherwise, this variable is generated only when data of the unrecognized MIME type is encountered. However, a better way to access the original POST data is php: // input. $ HTTP_RAW_POST_DATA is unavailable for enctype = "multipart/form-data" form data. Question: $ HTTP_RAW_POST_DATA ==$ _ POST? The answer is No.My personal understanding is like this:
1: $ POST. we don't need to introduce the common ones.
2:$GLOBALS['HTTP_RAW_POST_DATA']:
Basically, $ GLOBALS ['http _ RAW_POST_DATA '] is the same as $ _ POST. However, if the post data is not recognized by PHP, you can use $ GLOBALS ['http _ RAW_POST_DATA '] to receive the data, such as text/xml or soap. The default data Type recognized by PHP is the application/x-www.form-urlencoded standard data Type, with Content-Type = text/xml Type, submit an xml document Content to the php server, how to obtain the POST data. The RAW/uninterpreted http post information can be accessed: $ GLOBALS ['http _ RAW_POST_DATA '] This is useful in cases where the post Content-Type is not something PHP understands (such as text/xml ). because PHP only recognizes the application/x-www.form-urlencoded standard data type by default, the content of the type such as text/xml cannot be parsed as $ _ POST array, so the prototype is retained, it is sent to $ GLOBALS ['http _ RAW_POST_DATA '] for receiving.
3: php: // input can also implement this function: php: // input allows reading the original POST data. Compared with $ HTTP_RAW_POST_DATA, it puts less pressure on the memory and does not require any special php. ini settings. Php: // input cannot be used for enctype = "multipart/form-data ". Example: leyangjun.html leyangjun. php:
"; Print_r ($ _ POST); $ data = file_get_contents ('php: // input'); // unlock the print_r (urldecode ($ data); echo"
"; Print_r (urldecode ($ GLOBALS ['http _ RAW_POST_DATA ']);?>