Home > PHP Framework > ThinkPHP > How to solve the problem that thinkphp module does not exist

How to solve the problem that thinkphp module does not exist

爱喝马黛茶的安东尼
Release: 2019-08-26 13:45:07
Original
13227 people have browsed it

How to solve the problem that thinkphp module does not exist

How to solve the problem that thinkphp module does not exist?

Solution:

1. Add the "EmptyBaseController.class.php" file in the \application\Common\Controller directory.

<?php/**
*@Author:HTL
*@Email:Huangyuan413026@163.com
*@DateTime:2015-07-1411:22:18
*@Description:空模板控制器
*@use:其他项目添加EmptyController文件并继承该类即可
*/namespace Common\Controller;useThink\Controller;class EmptyBaseController extendsController{function_initialize()
{//项目配置文件中的配置项
$emptyPath=C("EMPTY_PATH");//如果未配置默认的地址
if(!$emptyPath || empty($emptyPath))$emptyPath="/";header("Location:".$emptyPath);exit();
}
}
Copy after login

Related recommendations: "ThinkPHP Tutorial"

2. Add EmptyController.class.php in the Controller directory of all projects and inherit "\Common\Controller\EmptyBaseController ".​ ​ ​ ​ ​

<?php/**
*@Author:HTL
*@Email:Huangyuan413026@163.com
*@DateTime:2015-07-1411:22:18
*@Description:空模板控制器,直接继承\Common\Controller\EmptyBaseController即可
*/namespace Portal\Controller;class EmptyControllerextends \Common\Controller\EmptyBaseController{
function _initialize(){
parent::_initialize();
}
}
Copy after login

3. Add the "EMPTY_PATH" item in \data\conf\config.php to customize the page that needs to be jumped when accessing a module that does not exist.         

<?php return array(&#39;EMPTY_PATH&#39;=>&#39;/index.php&#39;,/*访问不存在的模块时跳转的地址*///其他配置项);?
>
Copy after login

The above is the detailed content of How to solve the problem that thinkphp module does not exist. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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