class Goods extends Command
{
protected function configure()
{
$this->setName("goods")->setDescription('定时更新商品数据');
}
protected function execute(Input $input, Output $output)
{
dump("执行定时任务");
}
}
配置application/command.php文件
return [
'app\home\command\Goods',
];
通过命令行think php goods执行代码