问题
Please note I am using codeigniter 3.0.3.
In my current project I want to use both query string and segment base url. When I enable
$config['enable_query_strings'] = TRUE
segment base stopped working. I have used all options of uri protocol e.g.
$config['uri_protocol'] = 'PATH_INFO'; //REQUEST_URI,QUERY_STRING
Is there any way to use both with out any errors. I want to use url helpers in segmented url's and at few places I want to use query strings too.
回答1:
Checking URI.php core class, it can be seen that query appendix is meant to work when config uri protocol is set to
$config['uri_protocol'] = 'REQUEST_URI';
You don't need to set
config['enable_query_strings'] = TRUE;
option to true
if you want to be able to grab key=value from URI. It is needed only if you want query strings without segments in URI.
You can optionally enable standard query string based URLs:
example.com?who=me&what=something&where=here
So your options should be
$config['uri_protocol'] = 'REQUEST_URI';
config['enable_query_strings'] = FALSE;
来源:https://stackoverflow.com/questions/36947577/codeigniter-how-to-enable-segment-base-urls-and-query-string-url-at-the-same-tim