优化excel导出
This commit is contained in:
29
extend/catcher/library/excel/Factory.php
Normal file
29
extend/catcher/library/excel/Factory.php
Normal 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));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user