使用Thinkphp6.0 在Linux搭建简易的计划任务
实现流程
1.创建一个自定义指令。
2.编写sh文件,随意放置,并给执行权限。
3.Linux执行crontab -e 编辑计划任务
第一步:自定义指令
1.进入项目根目录cmd,执行
php think make:command Contrab
输出:Command:app\command\Contrab created successfully.就说明自动的生成了文件
2.进入app\command\Contrab修改execute方法
protected function execute(Input $input, Output $output)
{
//app\index\controller(命名空间) Index::index(Index控制器下的index方法)