Reputation: 179
I'm truing to parse arguments like http://localhost/img/
module/border.php?type,colorScheme,template
.
How to parse it by $_GET
?
print_r($_GET);
outputs Array ( [type,colorScheme,template] => )
Upvotes: 2
Views: 128
Reputation: 7609
What you wrote in $_GET
is 1 variable.
To separate multiple $_GET
variables, use &
.
http://localhost/img/module/border.php?type&colorScheme&template
To assign values write
?type=sometype&colorScheme=somecolor&template=sometemplate
If you really need/want to send 1 $_GET
variable as you wrote, use explode()
which need the delimiter and the string to split:
explode(",", key($_GET));
PHP.net - explode
PHP.net - key
Upvotes: 0
Reputation: 2639
Use $_SERVER['QUERY_STRING']
, it contains the data that you are looking for.
After that, just explode this like explode(',',$_SERVER['QUERY_STRING'])
.
OUTPUT
Array
(
[0] => type
[1] => colorScheme
[2] => template
)
Upvotes: 0