How can I escape the []? If I execute the following code, it just throws me an error
JavaScript
x
<?php
$url = 'http://www.example.com/page/?type=software&sortby=title&sortdirection=asc&Name[]=make%3A%20microsoft';
$url_components = parse_url($url);
parse_str($url_components['query'], $params);
echo ' The '.print_r($params['Name[]']);
?>
Advertisement
Answer
The name is just Name
and you should use implode
to join the pieces back together.
JavaScript
echo ' The '. implode($params['Name']);
This assumes your parameter is always Name[]
.