创建并注册了测试命令,如下所示
app\console\commands\Update.php
个文件:
`
//signature
protected $signature = 'Thumi';
…….
//handle to execute console command
public function handle()
{
$user = User::findOrFail(6);
$user->update(['fname' => 'kennnn']);
}
app \ console \ Kernel.php
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Update::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('Thumi')
->everyFiveMinutes();
}
`
命令正在localhost的CLI上执行。
Php artisan Thumi
以下是我在Cpanel分支中插入的命令。
*/5 * * * * /usr/local/bin/php /home/bladeres/public_html/WMS/artisan schedule:run >> /dev/null 2>&1
忽略电子邮件通知。另外,我将php版本更改为7.1,这可能是共享主机提供商的原因还是问题?