thinkphp6:如何在多应用模式下配置路由
2022-11-24 11:10:29
225
{{single.collect_count}}

1.创建route目录

给需要设置路由的模块新增route文件夹
在这里插入图片描述
注意:index文件名可以更改。
index.php文件结构

//文件地址namespace app\demo\route;//使用Route对象use think\facade\Route;/***配置路由param1:在浏览器上的地址param2:文件中的相对路径param3:请求方法,get还是post**、Route::rule('test','detail/index','GET');

2.访问

注意:在浏览器中访问路径的时候,需要在路径前方加上当前模块的名称

举例子:

以下是错误的

http://127.0.0.1/test

以下是正确的

http://127.0.0.1/demo/test

预览
在这里插入图片描述

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}