Reputation: 1094
I am working on one project in that I am passing users data via query string in url , so I have enabled it inside config.php but after this if I try to call other methods in project then it is not working and again when disabled query string in config.php all methods are working fine, I don't know why enable query string affected on all methods in controller.
Note: I am using routing so it is lik this
$config['enable_query_strings'] = TRUE;// afte making true unable to call other methods in controller.
$route['xyz_method/(:any)'] = 'controller/method1/$1';
$link=urlencode(base64_encode("some_data"));
<li><a href="<?=base_url('xyz_method/?param='.$link)?>">Click here</a></li>
Upvotes: 0
Views: 47
Reputation: 46
"... CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you’ll see these items:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
If you change “enable_query_strings” to TRUE this feature will become active. Your controllers and functions will then be accessible using the “trigger” words you’ve set to invoke your controllers and methods:
index.php?c=controller&m=method
Note
If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed to work with segment based URLs. ..."
See documentation here
Upvotes: 1
Reputation: 746
To work this, try using this
$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;
Upvotes: 0