Commit 743a7ee4 authored by 梁俊杰's avatar 梁俊杰

优化对二维数组的支持

parent 9b1b91b1
......@@ -37,7 +37,10 @@ class Exporter
CONST EXPORTER_TYPE_CSV = 1;
CONST EXPORTER_TYPE_XLS = 2;
CONST EXPORTER_TYPE_XLSX = 3;
/**
* @var ConfigInterface
*/
protected $config;
private $rootPath;
private $beginRowIndex = 0;
private $fileType = 'Xlsx';
......@@ -48,11 +51,6 @@ class Exporter
private $name = "";
private $beginColumnChar = "A";
/**
* @var ConfigInterface
*/
protected $config;
/**
* Exporter constructor.
* @param int $export_type 类型
......@@ -196,8 +194,11 @@ class Exporter
public function append(array $data, $keys = [])
{
// 一维数组转二维
if (!(isset($data[0]) && is_array($data[0]))) {
$data = [$data];
foreach ($data as $v) {
if (!is_array($v)) {
$data = [$data];
}
break;
}
if (count($keys)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment