The data type recognized by PHP by default is the application/x-www.form-urlencoded standard data type.
PHP gets the post parameters in several ways
1, $_post[' paramname '] can only receive data submitted by content-type:application/x-www-form-urlencoded ... PHP will populate the HTTP request body with the corresponding data into the array $_post , the data filled into the $_post array is the result of UrlDecode () parsing. (In fact, in addition to the Content-type, there are multipart/form-data that the data is the form data)
2, file_get_contents ("Php://input") for most types of content-type
Php://input allows the raw data to be read from the POST. Compared to $HTTP _raw_post_data, it brings less pressure to memory and does not require any special php.ini settings. Php://input cannot be used for enctype= "Multipart/form-data".
3, $GLOBALS [' Http_raw_post_data ']; Always produce $HTTP_RAW_POST_DATA a variable containing the original POST data. This variable is only generated when it encounters data that does not recognize the MIME type. $HTTP _raw_post_data is not available for enctype= ' multipart/form-data ' form data.
If the POST data is not recognized by PHP, you can use $GLOBALS [' Http_raw_post_data '] to receive it, such as text/xml or soap, and so on. You need to set the Always_populate_raw_post_data value in php.ini to on,php to always fill the post data into the variable $http_raw_post_data.
1,coentent-type only in two cases where the value is application/x-www-data-urlencoded and Multipart/form-data, PHP fills the corresponding data in the HTTP request packet into the global variable $_ POST
2,php an unrecognized content-type type, the corresponding data in the HTTP request packet is filled in with the variable $http_raw_post_data
3, only Coentent-type is not multipart/form-data, PHP will not fill in the HTTP request packet of the corresponding data in PHP://input, otherwise will. The length of the fill, specified by Coentent-length.
4, only Content-type is application/x-www-data-urlencoded, php://input data is consistent with $_post data.
5,php://input data is always the same as $http_raw_post_data, but php://input is more efficient than $http_raw_post_data and does not require special settings php.ini
6,php will fill in the Query_path portion of the path field into the global variable $_get. Typically, the Get method submits an HTTP request, and the body is empty.
http://blog.163.com/hooky_2005/blog/static/5793523720104284204067/
PHP gets the post parameters in several ways