usually when we access the TP directory, are: Http://xxx/index.php/Home/Index/index, in/module/controller/operation mode access, but this is not good for the URL optimization, so we usually hide the Home (module) to http://xxx/ Index.php/index/index this way to access.
TP in the official website of the document is said in the configuration file configuration of the 2 can achieve this effect, but the actual is not enough.
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8E/52/wKioL1i9ao3T7yD-AACjdpfip0c114.png-wh_500x0-wm_ 3-wmp_4-s_3961524513.png "title=" qq picture 20170306215538.png "alt=" Wkiol1i9ao3t7yd-aacjdpfip0c114.png-wh_50 "/>
So we can recommend 2 ways to achieve this effect here.
1. Add the following code to the index.php file
Define (' Default_module ', ' Home ')//Set Default module
2. Modify the thinkphp/libary/think/dispather.class.php file
$_get[$varModule] = preg_replace ('/\. ' __ext__. ' $/i ', ', $paths [0];
$_server[' path_info ' = Isset ($paths [1])? $paths [1]: ';
Change into
$allowList = C (' module_allow_list '); List of allowed modules
$module = Preg_replace ('/\. '. __ext__. ' $/i ', ', $paths [0];
if (Empty ($allowList) | | (Is_array ($allowList) && in_array_case ($module, $allowList))) {
$_get[$varModule] = $module;
$_server[' path_info ' = Isset ($paths [1])? $paths [1]: ';
}
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8E/68/wKioL1i_tfSQMIw5AAC3m1PbtR8199.png-wh_500x0-wm_ 3-wmp_4-s_1892705421.png "title=" qq picture 20170308154225.png "alt=" Wkiol1i_tfsqmiw5aac3m1pbtr8199.png-wh_50 "/>
The effect can be achieved after operation.
This article is from the "12633313" blog, please be sure to keep this source http://12643313.blog.51cto.com/12633313/1904372
Thinkphp3.2 removing modules when accessing URLs