五彩盒子五彩盒子五彩盒子

tp5设置默认模块不生效怎么配置隐藏模块

    在做TP5.1项目的时候,已经在配置文件中配置了默认模块。但是发现如果在请求url上不带模块名称会提示找不到模块。

以下是本次解决方案:
1、找到入口文件

2、替换:

// 执行应用并响应
//Container::get('app')->bind('index')->run()->send();
//判断绑定应用
$_other = 'admin|other'; // 这里是除了绑定以外的所有其他应用
if (preg_match('/^\/('.$_other.')\/?/', $_SERVER['REQUEST_URI'])) {
    Container::get('app')->run()->send();
} else {
    Container::get('app')->bind('index')->run()->send();    //默认绑定应用
}


热门推荐