Home >Backend Development >PHP Tutorial >Several ways to get post parameters in php

Several ways to get post parameters in php

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:13:402431browse

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
------------------


< ;input type="text" name="user">



post. php
---------------------------

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn