定时任务demo

pull/1/head
limu 12 months ago
parent 742b791cc2
commit 72975a1614
  1. 28
      app/command/test.php
  2. 2
      config/console.php

@ -0,0 +1,28 @@
<?php
declare (strict_types=1);
namespace app\command;
use think\console\Command;
use think\console\Output;
use think\console\Input;
use think\facade\Db;
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test
class test extends Command
{
protected function configure()
{
// 指令配置
$this->setName('test')
->setDescription('测试demo');
}
protected function execute(Input $input, Output $output)
{
echo date('Y-m-d H:i:s') . '完成';
}
}

@ -7,5 +7,7 @@ return [
'commands' => [
// 定时任务
'timer' => \app\timer\command\Timer::class,
//test脚本
'test' => 'app\command\test',
],
];

Loading…
Cancel
Save