Home > PHP Framework > ThinkPHP > Two ways to remove the home module in the TP framework

Two ways to remove the home module in the TP framework

藏色散人
Release: 2021-09-13 14:16:03
forward
1995 people have browsed it

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!

Two ways to remove the home module in the TP framework

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

Two ways to remove the home module in the TP framework

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

Two ways to remove the home module in the TP framework

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', // 默认模块
Copy after login

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!

Related labels:
source:jianshu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template