thinkphp frameworkThe tutorial column will introduce you to two methods of removing the home module in the TP framework. I hope it will be helpful to friends in need!
Sometimes we will also remove Home, which means that when we visit www.olcms.com/News/read/id/1.html it is equivalent to visiting www. olcms.com/Home/News/read/id/1.html, remove the home module, there are two methods.
1. The first method is to bind the Home module. I think it is best not to use this method. Apache is fine. I can follow http://www.jianshu.com/p/5e62bd1a9edc on the nginx server. As mentioned, if it is configured in nginx, it will be normal to access the frontend, but when accessing the backend, it will report that the admin.php module does not exist. Let’s talk about this method
Bind the Home module under index.php
define('BIND_MODULE','ThinkerInternet');
, and then in the root directory Add an admin.php to bind the admin module, as follows
The above link will be successful. The background link is xxx.com/admin.php, but This method is not recommended. Let’s talk about the second method
2. Specify the default module
As shown above, in Common/Conf/config. Add the following code to the php configuration file
'URL_MODEL'=>2, 'MODULE_ALLOW_LIST' => array('Home','Admin'),//指定可访问的模块,不许填写,如果还有其他模块也要写上 'DEFAULT_MODULE' => 'Home', // 默认模块
to get it done. . . Of course the backend address is xxx.com/admin/...
Recommended: "The latest 10 thinkphp video tutorials"
The above is the detailed content of Two ways to remove the home module in the TP framework. For more information, please follow other related articles on the PHP Chinese website!