During the development process, GET and POST are like souls, everywhere. The $_GET variable is an array containing the variable names and values sent by the HTTP GET method.
The $_GET variable is used to collect values from the form with method="get". Information sent from a form with the GET method is visible to everyone (displayed in the browser's address bar), and there is a limit on the amount of information sent (maximum 100 characters).
When using $_GET variables, all variable names and values will be displayed in the URL. So this method should not be used when sending passwords or other sensitive information. However, because the variables appear in the URL, you can bookmark the page. In some cases this is useful.
Generally speaking, URLs will use the & operator to separate multiple variables. Of course, you can also set it to other symbols. Use the ',' symbol as the variable separator symbol. Here we can use two methods to achieve it:
1. Modify php.ini
—— ; list of separator(s) used by php to parse input urls into variables. ; default is "&". ; note: every character in this directive is considered as separator! arg_separator.input = ";," ————
2. Write your own explanation grammar
list($key,$value)=$_get; //将get变量分解出来 $tmp=explode(",",$value); //将数据分出
The advantage of this usage is that others cannot know who uses the value you pass, and you need to understand the use of each value.
For the value passing of get methods such as http://www.bkjia.com/test.php?website=bkjia.com, the method is actually the same as method two. What is needed is to convert the key into value for decomposition. , I think this method is better than the previous method and more convenient.
$value = key($_GET); $tmp = explode(",", $value); print_r($tmp);
You should have obtained these data.
To traverse the $_GET variable with multiple elements, you can use the following method:
while( list($key, $value) = each($_GET) ) { echo "Key: $key; Value: $value <br />"; }
Also available:
foreach ($_GET as $key => $value) { echo "Key: $key; Value: $value <br />n"; }
Regarding the $_REQUEST variable, PHP’s $_REQUEST variable contains the contents of $_GET, $_POST and $_COOKIE. PHP's $_REQUEST variable can be used to obtain the results of form data sent via GET and POST methods.