The $_GET array in PHP is a superglobal variable that can be used to obtain information sent via a URL query string. Typically, each key in the array represents a variable name, while the corresponding value contains the associated value. By default, the $_GET values are treated as strings.
However, it is possible to pass an array value in the $_GET query string. To do this, you need to use the following syntax:
http://link/foo.php?id[]=1&id[]=2&id[]=3
In this case, the "id" parameter becomes an array with three elements, each containing one of the values provided in the query string.
On the PHP side, you can access the array value using the following syntax:
$_GET['id'];
This will return an array containing the three values that were passed in the query string.
Consider the following PHP script:
If you access this script via a URL like the following:
http://link/foo.php?id[]=1&id[]=2&id[]=3
The script will output the following array:
Array ( [0] => 1 [1] => 2 [2] => 3 )
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3