thinkphp6注解路由的使用方法
2022-11-24 11:10:29
160
{{single.collect_count}}

thinkphp6注解路由的使用方法

注解路由

ThinkPHP支持使用注解方式定义路由(也称为注解路由),如果需要使用注解路由需要安装额外的扩展:

composer require topthink/think-annotation

然后只需要直接在控制器类的方法注释中定义,例如:

<?phpnamespace app\controller;use think\annotation\Route;class Index{  
回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}