laravel - 没有计划的命令准备好运行。拉拉维尔 8
问题描述
我正在尝试使用调度程序每分钟运行一次命令,但调度程序:运行打印没有计划的命令准备好运行。信息。据我了解,如果我想通过运行命令测试 shcedulder,我不需要设置 cronjob。任何如何解决这个问题的建议表示赞赏
我的命令:
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'print:log';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Print in log';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
info('message from command');
}
内核.php
protected $commands = [
'App\Console\Commands\PrintLog',
];
protected function schedule(Schedule $schedule)
{
$schedule->command('print:log')->everyMinute();
}
解决方案
你可以试试吗?
protected $commands = [
Commands\PrintLog::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('print:log')->everyMinute();
}
推荐阅读
- android - 仅来自三星 S5 设备的“SocketTimeoutException: failed to connect to”
- algorithm - 减少闭合轮廓中点数的已知算法
- python - 有没有办法在单个数据点内有多个绘图以与分类器一起使用?
- graphql - GraphQL 突变问题
- scala - 如何在 Scala 中区分 SortedMap 和 TreeMap?
- asp.net-core-mvc - 有条件地处理 ASP.NET Core 中的拒绝访问行为
- javascript - 如何始终在单击的元素下方打开 contextMenu?
- javascript - 无法在谷歌表单中设置依赖下拉
- ios - Xamarin iOS 在 UIButton 中显示图像和文本
- c# - 为什么在运行时调用重载函数时会发生 RuntimeBinderException?