我尝试将此文件存储到S3
时出现异常类Maatwebsite \ Excel \ Writers \ LaravelExcelWriter的对象不能 被转换为字符串
这是我的代码:
$file = Excel::create('' . $date . '' , function($excel) use ($licencies) {
$excel->sheet('Excel', function($sheet) use ($licencies)
{
$sheet->fromArray($licencies);
});
});
Storage::disk('s3')->put($file , 'upload');
});
答案 0 :(得分:2)
$fileName = $date . '.xls';
$fileContent = Excel::create($fileName , function($excel) use ($licencies) {
$excel->sheet('Excel', function($sheet) use ($licencies) {
$sheet->fromArray($licencies);
});
})->string('xls');
Storage::disk('s3')->put($fileName, $fileContent);