![](/img/trans.png)
[英]How can I run my Laravel project without cmd command "php artisan serve"?
[英]How to run my scheduler with the php artisan serve command?
我在 Kernel.php 文件中的时间表 function 中添加了一个schedule->call(what_i_want_to_do)
。 我知道我可以通过运行php artisan schedule:run
命令来尝试,但是,当我使用php artisan serve
命令启动我的服务器时,我的调度程序不起作用。
如何让它发挥作用?
我的 kernel.php 时间表
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
Defi::whereDate('date_vis', '=', now())->update(['vis' => 1]);
})->everyMinute();
}
认为您还需要运行php artisan schedule:work
https://laravel.com/docs/scheduling#running-the-scheduler-locally
使用 cron 然后将其设置为运行 php artisan schedule:work every minute
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.