Is it possible to assign more than one value to the same GET parameter via http, as if I had passed an array in this parameter?
For example: link
Edit1: The application that will receive the request is developed in Laravel, if that influences.
Is it possible to assign more than one value to the same GET parameter via http, as if I had passed an array in this parameter?
For example: link
Edit1: The application that will receive the request is developed in Laravel, if that influences.
Yes, it is possible to pass in this way, you can use explode()
then to get each value individually.
$campos = explode(",", $_GET["campos"]);
You can also pass as an array
// ?campos[]=nome&campos[]=data&campos[]=endereco
$campos = $_GET["campos"]; // já vai ser um array
You can, of course, put []
after the parameter name, so it will automatically mount array
, the parameters would look like this:
• fields [] = name & fields [] = date & fields [] = address
When doing a var_dump($_GET)
, the return will be:
array (1) {["fields"] = > array (3) {[0] = > string (4) "name" [1] = > string (4) "data" [2] = > string (9) "address"}}