laravel 5.5导入excel文件 安装依赖:composer require maatwebsite/excel \Maatwebsite\Excel\Facades\Excel new \App\Imports\ImportData() \Maatwebsite\Excel\Facades\Excel::import(new \App\Imports\ImportData(), public_path('import_excel/filename.xls')); 在ImportData中处理excel的数据 小问题 安装依赖:composer require maatwebsite/excel \Maatwebsite\Excel\Facades\Excel new \App\Imports\ImportData() \Maatwebsite\Excel\Facades\Excel::import(new \App\Imports\ImportData(), public_path(‘import_excel/filename.xls’)); 在ImportData中处理excel的数据 小问题 excel日期单元格格式并不一定是日期,有时读到的会是数字,需要处理:KaTeX parse error: Undefined control sequence: \PhpOffice at position 8: date = \̲P̲h̲p̲O̲f̲f̲i̲c̲e̲\PhpSpreadsheet…date)->format(‘Y-m-d’); 整个文件处理过程是个事务操作,过程中有异常就会整体回滚 未完,待续 相关文章: 2021-07-31 2022-12-23 2021-06-09 2021-11-19 2021-06-21 2022-12-23