CodeIgniter Enabling Query Strings
I got this URL:
http://twitternieuws.com/class/function/ID?oauth_token=xxxxx&oauth_verifier=xxxxx
And I keep getting errors like "The page you requested was not found" or "The URI you submitted has disallowed charact开发者_运维问答ers". I tried changing the following options with different settings:
$config['permitted_uri_chars'];
$config['enable_query_strings'];
$config['uri_protocol'];
Is there anything I can do to make it work? I am using codeigniter 1.7.2
Query strings in 1.7.2 are a joke, it uses ?c=controller&m=method
to basically change your pretty urls to psuedo $_GET params. I really can't see why anyone would use it the way it's intended, it's very misleading and is not the same as normal query strings.
I highly suggest you check out the latest version of Codeigniter, where they do not unset the $_GET array (normal query strings are now usable). In one of the core files in the older versions it says CI does not use $_GET so we are going to unset() the global $_GET array
. Well, what if I need to use $GET? I always thought it was crazy, and people have been screaming for true $_GET support for forever.
Seriously though, it's time to upgrade:
Latest: https://bitbucket.org/ellislab/codeigniter-reactor/
Stable: http://codeigniter.com/
When upgrading to CodeIgniter 2 is not an option, you can recreate the $_GET variable like so (add this to every controller where you need the query string):
parse_str($_SERVER['QUERY_STRING'],$_GET);
And change this in your config.php file:
// $config['uri_protocol'] = "AUTO"; // change from this
$config['uri_protocol'] = "PATH_INFO"; // to this
精彩评论