How to use $_ REQUEST in php
This article mainly introduces the relevant knowledge of how to use $_ REQUEST in php, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will gain something after reading this article on how to use $_ REQUEST in php. Let's take a look.
In php, the predefined variable "$_ REQUEST" can be used to get the data submitted by the from form through POST or GET, or to get COOKIE information; it is an array that contains all the information about "$_ GET", "$_ POST" and "$_ COOKIE".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php predefined variable $_ REQUEST
In the actual development process, how do we get the data when we don't know how to submit the data in the form form?
A $_ REQUEST global variable is provided in PHP, which is an array containing $_ POST, $_ GET, and $_ COOKIE. The array structure is similar to $_ POST and $_ GET.
In other words, data submitted using POST or GET can be obtained using $_ REQUEST, or even $_ REQUEST to get information about COOKIE. By introducing the request_order attribute in PHP5.3, we can control what is contained in $_ REQUEST by changing the value of the request_order property in the php.ini configuration file.
The value of the request_order attribute can be the uppercase letters G, P, and C, which represent GET, POST, and COOKIE, respectively. By default, the default value of the request_order attribute is request_order= "GP", which does not contain C, which means that $_ REQUEST does not contain COOKIE information. If we want $_ REQUEST to contain COOKIE, we need to change it to request_order= "GPC".
Example:
Form submission
-get
Name:
Gender: male and female
Hobbies: reading, traveling, sports, surfing the Internet
Occupation: programmer, teacher, doctor, etc.
-post
Name:
Gender: male and female
Hobbies: reading, traveling, sports, surfing the Internet
Occupation: programmer, teacher, doctor, etc.
Run the above code, no matter which submission method you choose, you can successfully receive the information passed by the form using $_ REQUEST.
This is the end of the article on "how to use $_ REQUEST in php". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use $_ REQUEST in php". If you want to learn more, you are welcome to follow the industry information channel.