Laravel 5 计划不起作用
问题描述
我的 Laravel 版本是 5.0.28,我在 cloud9 上构建,并且在我的 cron 中添加了这个命令:
My laravel version is 5.0.28, I build on cloud9, and I added this command to my cron:
我在我的 Kernel.php
中添加了此代码.我参考了这个网站:https://laravel-news.com/2014/11/laravel-5-scheduler/
I added this code on my Kernel.php
. I referenced this site: https://laravel-news.com/2014/11/laravel-5-scheduler/
我等了一会儿还是不行,所以我尝试使用命令php artisan schedule:run
,我得到:没有准备好运行的预定命令.
代码>
I waited and it still didn't work, so I tried to use the command php artisan schedule:run
, and I got: No scheduled commands are ready to run.
我搜索并找到了这个答案:Laravel 5类不存在"使用调度器时
I searched and found this answer: Laravel 5 "Class does not exist" when using the scheduler
所以我修改了我的代码.另外,这段代码没有指定时间,所以我修改了我的 cron
来指定时间,但它仍然不起作用.我没有更多的想法.请帮忙.谢谢.
So I modified my code. Also, this code had no specified time, so I modified my cron
to specify a time, but it still doesn't work. I have no more ideas. please help. Thanks.
代码
cron
推荐答案
Laravel 调度程序 适用于命令,而不适用于控制器方法:
Laravel scheduler works with commands, not with controller methods:
- 创建命令:
- 编辑命令:
- 向
ConsoleKernel.php
添加命令:
- 在调度程序中使用命令:
这篇关于Laravel 5 计划不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!