Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c69188f8
authored
Apr 03, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
fix conflict
parents
6ed37108
f3ef38ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
app/Http/Controllers/OrderController.php
app/Http/Function.php
app/Http/Controllers/OrderController.php
View file @
c69188f8
This diff is collapsed.
Click to expand it.
app/Http/Function.php
View file @
c69188f8
...
...
@@ -2,6 +2,7 @@
/** 公用函数 */
//导出数据
//导出数据
function
exportExcel
(
$expTitle
,
$expCellName
,
$expTableData
)
{
$xlsTitle
=
iconv
(
'utf-8'
,
'gb2312'
,
$expTitle
);
//文件名称
...
...
@@ -13,6 +14,13 @@
$objPHPExcel
=
new
PHPExcel
();
include_once
(
__DIR__
.
"/../../vendor/PHPExcel/PHPExcel/IOFactory.php"
);
set_time_limit
(
0
);
//不对php(主要是写数据)执行时间做限制
ini_set
(
"memory_limit"
,
"1024M"
);
//设置内存(防爆内存)
$cacheMethod
=
\PHPExcel_CachedObjectStorageFactory
::
cache_in_memory_serialized
;
//设置缓存策略(减少内存占用)
//判断缓存策略是否可用
if
(
!
\PHPExcel_Settings
::
setCacheStorageMethod
(
$cacheMethod
))
{
die
(
$cacheMethod
.
" 缓存方法不可用"
.
EOL
);
}
$cellName
=
array
(
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
,
'AA'
,
'AB'
,
'AC'
,
'AD'
,
'AE'
,
'AF'
,
'AG'
,
'AH'
,
'AI'
,
'AJ'
,
'AK'
,
'AL'
,
'AM'
,
'AN'
,
'AO'
,
'AP'
,
'AQ'
,
'AR'
,
'AS'
,
'AT'
,
'AU'
,
'AV'
,
'AW'
,
'AX'
,
'AY'
,
'AZ'
);
//显示导出名称和导出时间
...
...
@@ -29,9 +37,11 @@
}
header
(
'pragma:public'
);
header
(
'Content-type:application/vnd.ms-excel;charset=utf-8;name="'
.
$xlsTitle
.
'.xls"'
);
header
(
"Content-Disposition:attachment;filename=
$fileName
.xls"
);
//attachment新窗口打印inline本窗口打印
$objWriter
=
PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
header
(
'Content-type:application/vnd.ms-excel;charset=utf-8;name="'
.
$xlsTitle
.
'.csv"'
);
header
(
"Content-Disposition:attachment;filename=
$fileName
.csv"
);
//attachment新窗口打印inline本窗口打印
//输出bom
print
(
chr
(
0xEF
)
.
chr
(
0xBB
)
.
chr
(
0xBF
));
$objWriter
=
PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'CSV'
);
$objWriter
->
save
(
'php://output'
);
exit
;
}
...
...
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