Home >Backend Development >PHP Tutorial >Example analysis of the difference between $_POST and php://input in php, _post example analysis_PHP tutorial

Example analysis of the difference between $_POST and php://input in php, _post example analysis_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:10:02953browse

Example analysis of the difference between $_POST and php://input in php, _post example analysis

This article analyzes the difference between $_POST and php://input in php with examples. Share it with everyone for your reference. The specific analysis is as follows:

$_POST and php tutorial://input can get the value, $HTTP_RAW_POST_DATA is empty
$_POST organizes the submitted data in an associative array and encodes it, such as urldecode, or even encoding conversion
php://input can also implement this function to obtain the original data of POST.
Code

Copy code The code is as follows:
echo file_get_contents( "php://input ");

Example
Copy code The code is as follows:





post.php
Copy code The code is as follows:


php://input allows reading the raw data of a 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".

php $_POST:

The $_POST variable is an array whose content is the variable name and value sent by the HTTP POST method.

The $_POST variable is used to collect values ​​from the form with method="post". The information sent from the form with the POST method is invisible to anyone (will not be displayed in the browser's address bar ), and there is no limit on the amount of messages sent.

html

Copy code The code is as follows:

Enter your name:
Enter your age:


welcome.php
Copy code The code is as follows:
Welcome .

You are years old!

Variables sent via HTTP POST will not be displayed in the URL, and there is no length limit for variables.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/939422.htmlTechArticleExample analysis of the difference between $_POST and php://input in php, _post example analysis This article provides an example analysis of php The difference between $_POST and php://input. Share it with everyone for your reference. The specific analysis is as follows:...
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