Reputation: 7964
Is there a way to enable query string in just one controller or for one function. For example, I want to use query string in search function, and segments in every other.
Is there a way to do this?
Can I do something like this:
$this->config->set_item('uri_protocol', 'PATH_INFO');
$this->config->set_item('enable_query_strings', TRUE);
Upvotes: 1
Views: 2483
Reputation: 3408
A simple way to achieve this is by parsing the server query string like so.
$get_data = array();
parse_str($_SERVER['QUERY_STRING'], $get_data);
This will leave you with a very insecure array full of data, so you should use CI's security class to make it more secure; so like;
$get_data = $this->security->xss_clean($get_data);
This will not mean that routing works via GET, only allow you to get the GET vars safely.
Upvotes: 5