The URL format in apppath/config. php.
$ Config ['uri _ Protocol'] = 'auto ';
This configuration item defines which server global variable you use to draw up a URL.
The default setting is auto, and round robin is performed in the following four methods. When your link cannot work, try to use an option other than auto.
'Auto' default-auto detects
'Path _ info' uses the path_info
'Query _ string' uses the QUERY_STRING
'Request _ URI 'uses the request_uri
'Orig _ path_info 'uses the orig_path_info
Several member variables in ci_uri
$ Keyval = array (); // list of cached URI segments $ uri_string; // current URI string $ segments // list of Uri segments $ rsegments = array () // re-indexed list of Uri segments
The obtained current URI string is assigned to $ uri_string through function _ set_uri_string ($ Str ).
Several options are available for getting $ STR, that is, the business flow section of _ fetch_uri_string ().
1. When $ config ['uri _ Protocol'] = 'auto' by default,ProgramRound Robin is performed to obtain the URI in the following way:
(1) When the program runs under CLI, that is, the PHP file under the command line. CI will get the URI like this
Private function _ parse_cli_args () {$ ARGs = array_slice ($ _ server ['argv'], 1); return $ ARGs? '/'. Implode ('/', $ ARGs ):'';}
// $ _ Server ['argv'] contains the parameters passed to the script. When the script runs in CLI, the C-format command line parameters are provided.
All parameters except the first in $ _ server ['argv ']
If you perform this operation in the command line
Php d: \ Wamp \ www \ codeigniter \ index. php \ Start \ Index
_ Parse_cli_args () returns a/index. php/start/index string.
(2) The Private function _ detect_uri () is called by default when request_uri is used to detect a URL ()
(3) If neither of the preceding methods can obtain the URI, $ _ server ['path _ info'] is used to obtain the URI.
$ Path = (isset ($ _ server ['path _ info'])? $ _ Server ['path _ info']: @ getenv ('path _ info'); If (TRIM ($ path ,'/')! = ''& $ Path! = "/". Self) {$ this-> _ set_uri_string ($ PATH); return ;}
(4) If none of the above three methods can be obtained, use $ _ server ['query _ string'] Or getenv ['query _ string'].
$ Path = (isset ($ _ server ['query _ string'])? $ _ Server ['query _ string']: @ getenv ('query _ string'); If (TRIM ($ path ,'/')! = '') {$ This-> _ set_uri_string ($ PATH); return;} (5) None of the above four methods can obtain the URI, you need to use the $ _ Get array.
If (is_array ($ _ Get) & count ($ _ Get) = 1 & trim (Key ($ _ Get ),'/')! = '') {$ This-> _ set_uri_string (Key ($ _ Get); return ;}
2. If $ config ['uri _ Protocol'] is set in config. php, the program will automatically execute corresponding operations to obtain the URI