1.app下创建目录
2.自定义一个文件类 我这里是Task
<?php
namespace app\common\command;
use app\User\model\User;
use think\console\Command;
use think\console\Input;
use think\console\Output;
class Task extends Command
{
protected function configure()
{
$this->setName('task')->setDescription('Here is the remark ');
}
protected function execute(Input $input, Output $output)
{
User::where('u_id', 1)->setField('add', ['INC', 100]);//这个是需要操作的数据库
}
}
3.把我们的项目通过宝塔进行上线
4.在线上配置数据库
5. 线上数据库和项目数据库进行匹配。
6.匹配完成后,就可以设计计划任务了
7.操作完成后,依次点击,来查看是否执行成功。
8.执行成功