添加crontab
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
php 要写全路径
添加命令
在 App\Console\Kernel
类的 schedule
方法中定义所有调度任务
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
DB::table('recent_users')->delete();
})->daily();
$schedule->call(function () {
echo 'I am crontab';
})->everyMinute();
}
在里面 可以添加多个命令
windows 本地 执行
php artisan schedule:run