开发者

How to extract get variable from query string in codeigniter?

开发者 https://www.devze.com 2023-01-15 12:32 出处:网络
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

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

精彩评论

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

关注公众号