首页 > 解决方案 > 如何在 laravel 中使用 cron 作业在 localpath 中存储 excel 文件?

问题描述

我正在使用 Laravel 5.7 和 Windows 调度程序进行 cron 作业。我想使用 cron 作业存储 excel 文件。我怎样才能做到这一点?

我用过Excel::store()方法。但它只有在我点击按钮时才有效。如何使用 cron 作业来实现这一点?

我尝试使用此代码:

protected $signature = 'excel:attendance';

protected $description = 'Using smart office excel for attendance';

public function __construct()
{
    parent::__construct();
}

public function handle()
{
    Excel::store(new attendanceExcel(),'Dummy_excel_cronjob.xlsx');
}

但这不起作用。

标签: laravelcron

解决方案


推荐阅读