美文网首页
thinkphp5 去掉模块直接访问控制器的方法

thinkphp5 去掉模块直接访问控制器的方法

作者: 呦丶耍脾气 | 来源:发表于2017-09-19 16:40 被阅读48次

实现实例

访问www.xxx.com/blog/index.html相当于访问www.xxx.com/index/blog/index.html

方法一

绑定模块,在该应用目录找到route.php,添加如下代码

Route::bind('index');

也可以在该应用入口目录/public/index.php 中添加

// 绑定当前访问到index模块
define('BIND_MODULE','index');

方法二:使用路由别名设置

在该应用目录找到route.php,添加如下代码

Route::alias('blog','index/blog');//路由别名

相关文章

网友评论

      本文标题:thinkphp5 去掉模块直接访问控制器的方法

      本文链接:https://www.haomeiwen.com/subject/dyxgsxtx.html