问答 / 0 / 1 / 创建于 7年前 / 更新于 7年前
使用的Laravel版本为5.6
举个例子,在Kernel.php的任务调度方法中输出一句话:
Kernel.php
protected function schedule(Schedule $schedule) { echo 'schedule'; }
然后在命令行不管执行什么命令都会输出字符串schedule,比喻在命令行下执行:
schedule
php artisan list
为什么会这样?不是应该只有在运行命令:php artisan schedule:run时才会运行schedule()方法吗?
php artisan schedule:run
schedule()
不要想当然,追一下源码就知道了,在 Kernel 的构造方法里调用了
我要举报该,理由是:
推荐文章: