Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
743a7ee4
Commit
743a7ee4
authored
May 28, 2020
by
梁俊杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化对二维数组的支持
parent
9b1b91b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Exporter.php
src/Tools/Exporter.php
+9
-8
No files found.
src/Tools/Exporter.php
View file @
743a7ee4
...
...
@@ -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,9 +194,12 @@ class Exporter
public
function
append
(
array
$data
,
$keys
=
[])
{
// 一维数组转二维
if
(
!
(
isset
(
$data
[
0
])
&&
is_array
(
$data
[
0
])))
{
foreach
(
$data
as
$v
)
{
if
(
!
is_array
(
$v
))
{
$data
=
[
$data
];
}
break
;
}
if
(
count
(
$keys
))
{
foreach
(
$data
as
$k
=>
$v
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment