Similar to the $_GET variable (array), $_POST represents the array formed by the data submitted by the page through post.
post submits data, usually in only one form:
Project 1:
Project 2:
Its function is: after the user fills in the form data and submits it, the data will be sent (submitted) to the page abc.php. In fact, it can also be understood as "opening" the web page (abc.php), or " Request" this page (abc.php)
$v1 = $_POST['uName']; //Single quotation marks can also be used as double quotation marks. It is essentially a string and is actually the key name (subscript) of the array
$v2 = $_POST['uPswd']; //The key name must be exactly the same as the name when submitted (case sensitive)
//You can also display all post data:
var_dum($_POST)
?>
The form of receiving post data is: (in the abc.php web page)
Usually, the form form in the web page generally uses the post method, and the get method is generally reflected in the other three forms
$_REQUEST variable (array)
The $_REQUEST array is not actually an independent data source, but the "sum" of $POST data and $_GET data
That is, the $_REQUEST array includes all $_POST data and $_GET data--it is actually automatically stored within the system.
Usually, $_POST data and $_GET data do not "appear at the same time", and the $_REQUEST array represents one of them.
Situation when get and post data are submitted at the same time:
At this time, this situation generally occurs in only one html syntax form, as follows:
Project 1:
Project 2:
At this time, the two data uName and uPswd are submitted to abc.php in post mode
And at the same time: a=5 and b=10 two data, submitted to abc.php in get mode
Then get the data in the page like this:
$v1 = $_GET['a'];
$v2 = $_GET['b];
Get post data like this:
$v3 = $_POST['uName'];
$v4 = $_POST['uPswd'];
However, you can also get all the data like this:
$v1 = $_REQUEST['a'];
$v2 = $_REQUEST['b];
$v3 = $_REQUEST['uName'];
$v4 = $_REQUEST['uPswd']
When the get data and post data are submitted at the same time and there are duplicate names:
wKioL1ZB0guxMIlkAABmi-th574335.jpg
1: Try to avoid duplicate names
2: If there is a duplicate name, $_REQUEST will only record (store) one of the data (either get data or post data)
3: As for which one is recorded, it is determined by a setting in php.ini
request_order = "GP"; //This is the default value, G stands for GET, P stands for POST
The meaning is: store GET data first, then store POST data
It can be seen that if the name is the same, the POST data will overwrite the GET data
Change to: request_order = "PG", the order is reversed. . . . .
Note: $_REQUEST, $_GET, $_POST are independent of each other!
$_SERVER variable (array)
This variable stores some request information or setting information of the server or client. There are many, and different servers and different request pages may have different data items.
Commonly used ones are:
REMOTE_ADDR User’s IP address
SERVER_ADDR Server-side IP address
SERVER_NAME Server name (host name)
DOCUMENT_ROOT absolute path to the site (actually the DocumentRoot in the host settings
PHP_SELF The file path of the current web page
QUEER_STRING represents the overall font string of a get request, similar to this:
http://www.abc.com/abc.php?a=5&b=10 “a=5&b=10” in the link address
Output all items (may vary per server): 9000000000000000
http://www.bkjia.com/PHPjc/1069908.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1069908.htmlTechArticlePHP’s post data and request data PHP’s post data and request data $_POST variable (array) similar to $_GET variable (array), $_POST represents the data submitted by the page through post...
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