thinkphp模块不存在怎么解决?
解决方案:
1.在\application\Common\Controller目录下添加“EmptyBaseController.class.php”文件。<?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();
}
}
2.在所有项目的Controller目录下添加EmptyController.class.php并继承”\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();
}
}
3.在\data\conf\config.php里添加" EMPTY_PATH "项自定义当访问不存在的模块时需要跳转的页面。<?php return array('EMPTY_PATH'=>'/index.php',/*访问不存在的模块时跳转的地址*///其他配置项);?
>