-
In general, we do not use this approach to pass array parameters to the destination URL. The common practice is to commit array parameters by expressing them, or to submit them asynchronously via an AJAX form.
However, usually the word is for the special existence, if you really need to use non-mainstream way to pass the array parameters, the webmaster also prepared for you an imperfect solution. Take a look at the following code:
<meta charset= ' utf-8′>
<pre>
<?php
if ($_get[' names ']) {
$arr =explode ('-', $_get[' names ']);
Print_r ($arr);
Exit ();
}
$names = Array ("11″," 22″, "33″");
$arg =implode ('-', $names);
$url = "http://localhost/root/bd.php?names=". $arg;
Header ("Location: $url");
?>
Code Description:
1, we first convert the array to a string, and then receive the parameters at the target URL, and then restore the string to an array
2. This method only applies to one-dimensional arrays
3, the array can not be too large, or will exceed the maximum URL length
4, the connector suggested using '-' or '/', not recommended ', '
Obviously, the above processing can meet the requirements of the URL passing array, but it is limited, not perfect, and deal with a little bit of difficulty. Still, it does solve some of the problems, hoping that the webmaster's scheme will help programmers who are experiencing this problem.