我想使用一個程序 (Freescout) 作為 Laravel 程序。它工作正常,除了我必須做一個 cron 工作: * * * * * php /var/userdata/web/.../website/helpdesk/artisan schedule:run >> /dev/null 2>&1,但我無法在終端中運行它,無法使用任何 CLI,只需設置一個 Cron 來運行 PHP 腳本。(共享托管服務器)。所以我創(chuàng)建了一個名為artisan_schedule_runner.php的文件 ,它很簡單:Route::get('/foo', function () { Artisan::call('schedule:run >> /dev/null 2>&1'); //});我應該如何擴展我的代碼以使其工作?先感謝您!
1 回答

阿晨1998
TA貢獻2037條經(jīng)驗 獲得超6個贊
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);?
$input = new Symfony\Component\Console\Input\ArrayInput(['command' => 'schedule:run']);
$output = new Symfony\Component\Console\Output\StreamOutput(fopen('output.log', 'a', false));?
$status = $kernel->handle( $input, $output );
- 1 回答
- 0 關注
- 348 瀏覽
添加回答
舉報
0/150
提交
取消