Home >Backend Development >PHP Tutorial >Several ways to get post parameters in php
Several ways for PHP to get post parameters
1. $_POST['paramName'] can only receive data submitted by Content-Type: application/x-www-form-urlencoded
2. file_get_contents( "php://input") Applicable to most types of Content-type
php://input allows reading the raw data of POST. It puts less pressure on memory than $HTTP_RAW_POST_DATA and does not require any special php.ini settings. php://input cannot be used with enctype="multipart/form-data".
3. $GLOBALS['HTTP_RAW_POST_DATA']; always generates $HTTP_RAW_POST_DATA variable containing the original POST data. This variable is only generated when data of an unrecognized MIME type is encountered. $HTTP_RAW_POST_DATA is not available for enctype="multipart/form-data" form data.
If the posted data is not recognized by PHP, you can use $GLOBALS['HTTP_RAW_POST_DATA'] to receive it, such as text/xml or soap, etc.
demo:
application
a.htm
------------------
HTTP request reference:
http://blog.csdn.net/kfanning/article/details/6062118
Reprinted from: http://lhdst-163-com.iteye.com/blog/1680297
The above introduces several ways for PHP to obtain post parameters, including relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.