Maatwebsite Excel 汇出遇到 Empty file 问题

背景:Laravel App

Package:maatwebsite/excel ^3.1

问题:用 Excel::store($arg1, $arg2) 时,汇出的档案是 Empty。

解决:$arg1 必须是 Laravel Collection,不能是阵列,所以改善的办法是建立一个 export class

php artisan make:export YourExport...Excel::store(new YourExport($data), $arg2);

[ 参考 ]
官方文件:https://docs.laravel-excel.com/3.1/getting-started/

Stackoverflow:https://stackoverflow.com/questions/70234881/laravel-export-excel-from-array-return-empty-file

範例:https://www.itsolutionstuff.com/post/laravel-create-csv-file-from-custom-array-using-maatwebsiteexample.html


关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章