如何在浏览器中运行工匠日程安排?

时间:2017-01-03 00:08:49

标签: php laravel laravel-5

请帮帮我。 如何运行此命令:

php /path/to/artisan schedule:run >> /dev/null 2>&1
浏览器中的

(example.com/runschedule)?

Laravel版本:5xx

我试过了

Route::get('/runschedule', function () {
    Artisan::call('schedule:run');
    return back()->with('status','Cron complete!');
});

但它不起作用。页面显示

  

(糟糕,看起来出了问题。)

1 个答案:

答案 0 :(得分:0)

您的命令运行正常,可能您的重定向也应该正常工作,您可能遇到的问题是您的预定命令中存在问题:

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{
    // This is the scheduled command

    $schedule->command('inspire')->hourly();
}

正如人们在此处所说,编辑您的.env文件并启用调试APP_DEBUG=true,同时查看您的日志:storage/logs/laravel.log