我正在研究 laravel 调度一切工作正常。我的日程安排代码如下:
public function handle()
{
//
$words = [
'aberration' => 'a state or condition markedly different from the norm',
'convivial' => 'occupied with or fond of the pleasures of good company',
'diaphanous' => 'so thin as to transmit light',
'elegy' => 'a mournful poem; a lament for the dead',
'ostensible' => 'appearing as such but not necessarily so'
];
$key = array_rand($words);
$value = $words[$key];
$word = new Word;
$word->word_key = $key;
$word->word_value = $value;
$word->save();
$this->info('Word of the Day saved in table');
}
protected function schedule(Schedule $schedule)
{
$schedule->command('word:day')->everyMinute();
}
之后,我运行PHP artisan schedule 命令:运行它将数据保存在 word 表中。
现在我的问题是,一分钟后它不再保存......我已经在谷歌上进行了研究并尝试了许多参考它根本不起作用。
我的项目在 E 驱动器路径是E:/xammp/htdocs/testtutorials/phpmonitor并且我在命令下运行但它不工作
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
----------------------------------------------------------
* * * * * php /E:/xammp/htdocs/testtutorials/phpmonitor/artisan schedule:run >> /dev/null 2>&1
它给了我以下错误:
该系统找不到指定的路径。