Laravel Scheduler每天运行两次

编程入门 行业动态 更新时间:2024-10-24 09:21:52
本文介绍了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每天运行两次

本文发布于:2023-11-27 05:18:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636758.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两次   Laravel   Scheduler

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!