In php, what is the difference between php: input and $ _ POST? post is an example of data that we commonly use to obtain form submissions. However, php: input is estimated that many of my friends have never used it. Let's take a look at it. In php, what is the difference between php: // input and $ _ POST? post is a common example of getting data submitted by forms, but php: // input is estimated that many of my friends have never used it any more. Let's take a look at it.
Script ec (2); script
Let's first look at two instances.
Example: php: // input
Post. php
Example: post
Html
Welcome. php
The Code is as follows: |
|
Welcome .
You are Years old!
|
Variables sent through http post are not displayed in the URL.
When we use $ _ POST to receive the information transmitted from the page, we can use php: // input to accept the value. What is the difference between them?
First, when $ _ POST and php: // input can get the value, $ HTTP_RAW_POST_DATA is blank;
$ Http_raw_post_data is a built-in global variable in PHP. It is used. PHP fills in the POST data as is in the variable $ http_raw_post_data when the Content-Type cannot be recognized. It cannot read POST data whose Content-Type is multipart/form-data. You need to set the always_populate_raw_post_data value in php. ini to On, and PHP will always fill in the POST data with the variable $ http_raw_post_data.
Then $ _ POST organizes the submitted data in an associated array and performs encoding, such as urldecode or even encoding conversion;
Php: // input: Raw POST data that has not been processed is obtained by reading files through the input stream;
Php: // input allows reading 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 ";
Php: // input cannot read $ _ GET data. The reason is that the $ _ GET data is written in the PATH field of the http Request header as query_path, rather than in the http Request body.