优化excel导出

This commit is contained in:
JaguarJack
2020-05-25 22:50:51 +08:00
parent 74a42e7022
commit bae43ad382
3 changed files with 45 additions and 23 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace catcher\library\excel;
use catcher\exceptions\FailedException;
use PhpOffice\PhpSpreadsheet\Writer\Csv;
use PhpOffice\PhpSpreadsheet\Writer\Xls;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class Factory
{
public static function make($type)
{
if ($type === 'xlsx') {
return app(Xlsx::class);
}
if ($type === 'xls') {
return app(Xls::class);
}
if ($type === 'csv') {
return app(Csv::class);
}
throw new FailedException(sprintf('Type [%s] not support', $type));
}
}