开发者

How to extract get variable from query string in codeigniter?

My issue is i have QUERY_STRING enabled in my codeigniter setup so that links look like this http://www.domain.com/search/index/page/4?squery=searchterm

I have a form on this page that uses GET because I can't use POST for what i'm using, when i try to retrieve the "squery" using $this->uri->segment(4) it doesn't return that part only the 4 p开发者_StackOverflowart. What way can i retrieve the search term ?

This is in my htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?/$1 [L]


Got it to work by doing this Changing my config variables

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

And changing my htaccess to this

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]

Help found here How to make CodeIgniter accept "query string" URLs?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜