Lumen 中的任务调度是否和 Laravel 中的一样?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33356416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:34:46  来源:igfitidea点击:

Does task scheduling in Lumen work just like in Laravel?

laravelscheduled-taskslaravel-5.1lumen

提问by prograhammer

You can see task schedulingexplained in the latest docs for Laravel, but Lumen's docs do not mention this. However, it looks like Lumen's Console Kernel filehas a schedule method just like Laravel. Does scheduling work the same in both, or what are the caveats with scheduling in Lumen?

你可以在 Laravel 的最新文档中看到任务调度的解释,但 Lumen 的文档没有提到这一点。但是,看起来Lumen 的 Console Kernel 文件和 Laravel 一样有调度方法。调度在两者中的工作方式是否相同,或者在 Lumen 中调度有哪些注意事项?

回答by Stan Smulders

Yes, yes it does! :) It works exactly the same.

是的,是的!:) 它的工作原理完全一样。

crontab -e

And then add

然后添加

* * * * * php /var/www/domain.com/public_html/artisan schedule:run 1>> /dev/null 2>&1

Come to think of it, the php artisan schedule:runkinda gives it away :p

想想看,php artisan schedule:run有点放弃它:p