Codeigniter Routes having GET variables Codeigniter Routes having GET variables codeigniter codeigniter

Codeigniter Routes having GET variables


i am not sure abot this but you could give a try by changing these values in the config file.

$config['uri_protocol'] = "PATH_INFO"; $config['enable_query_strings'] = TRUE; 

and try accessing the url like

$this->input->get(‘param’);


$route['^(beautified-link)'] = "controller/function";

I think it can be done by only specifying controller and method, no need to maintain route for passing GET variable.


why use get params?

autoload the url helper in config/autoload.php

$autoload['helper'] = array('url');

and you could be able to use a url like

http://example.com/controller/function/param

param could be a number, a string or anything you want

in the controller you can read the param with this

$var=$this->uri->segment(3);

or

$var=$this->uri->segment(4);//depend of number of "/" that you put on the url