thinkphp开启定时任务的三种办法(最全)
2022-11-24 11:10:29
300
{{single.collect_count}}

第一种方法

使用think-cron类库

//composer 安装composer require yunwuxin/think-cron

github文档地址

https://github.com/yunwuxin/think-cron

1.创建任务类

<?phpnamespace app\task;use yunwuxin\cron\Task
回帖
全部回帖({{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 ? '加载中...' : '查看更多评论'}}