且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Laravel中每分钟运行计划任务?

更新时间:2022-12-26 17:14:03

您应该通过 cron作业进行设置,使其每分钟运行一次.任务计划不能手动运行.

You should be setting this up via cron job to run every minute. Task scheduling is not intended to be run manually.

在终端运行中:

crontab -e

然后添加:

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

保存后,它将每分钟运行一次应用程序计划程序(无需运行php artisan schedule:run.

Once saved, this will then run the application scheduler every minute (without you needing to run php artisan schedule:run.

有关详细信息,请参阅文档.