CodeIgniter: Enable $_GET
June 25th, 2008 | by Isern Palaus |For security reasons CodeIgniter have $_GET disabled. I personally don’t use so much but if you want to enable $_GET on your application you only need to do two simple steps.
Security: CodeIgniter User Guide
[...]
GET data is simply disallowed by CodeIgniter since the system utilizes URI segments rather than traditional URL query strings (unless you have the query string option enabled in your config file). The global GET array is unset by the Input class during system initialization.
[...]
Now, if you want to use it:
- Go to config.php and find $config['uri_protocol'], change to:
$config['uri_protocol'] = "PATH_INFO";
- Rebuild the $_GET array on your controller:
parse_str($_SERVER['QUERY_STRING'],$_GET);
Tags: CodeIgniter, PHP, _GET
One Response to “CodeIgniter: Enable $_GET”
By ronnie on Aug 31, 2008 | Reply
thanks mang!