本文介绍了Laravel Scheduler每天运行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在特定时间每天两次运行Laravel Scheduler?假设我希望我的命令每天在上午9点和下午5点运行
How can I run Laravel scheduler twice daily at specific hours? Let's say I want my command to run every day at 9am and 5pm
可以选择每天使用两次,但是我不确定如何指定小时数
There is an option to use twiceDaily, but I'm not sure how to specify hours
推荐答案您可以使用手动cron表达式:
You can use manual cron expression:
$schedule->command('foo')->cron('0 9,17 * * *');了解更多: laravel/docs/5.0/artisan #scheduling-artisan-commands
如果您不熟悉cron表达式,请使用以下漂亮的GUI: cron .nmonitoring/cron-generator.html
If you're not familiar with cron expressions, here's the nice GUI: cron.nmonitoring/cron-generator.html
更多推荐
Laravel Scheduler每天运行两次
发布评论