public function tui_export(){
if(empty($_GET[‘userid’])){
showmessage(‘参数传递错误’, ‘?m=weixin&c=recommend_list&a=index’,2000);
}
$table=“co_weixin_couponsas cp LEFT JOIN co_cacos as c ON cp.userid=c.
userid”;
KaTeX parse error: Expected '}', got 'EOF' at end of input: …AND cp.userid={_GET[‘userid’]}";
i
n
f
o
s
=
infos=
infos=this->coupons_db->select(
w
h
e
r
e
,
′
c
p
.
∗
,
c
.
c
c
n
a
m
e
′
,
′
′
,
′
c
p
.
c
t
i
m
e
D
E
S
C
′
,
′
′
,
′
′
,
where,'cp.*,c.cc_name','','cp.c_time DESC','','',
where,′cp.∗,c.ccname′,′′,′cp.ctimeDESC′,′′,′′,table);
if(empty($infos)){
showmessage(‘数据为空,不可导出!!!’,’?m=weixin&c=recommend_list&a=index’,1000);
}
d
a
t
a
=
a
r
r
a
y
(
)
;
f
o
r
e
a
c
h
(
data = array(); foreach(
data=array();foreach(infos as
k
=
>
k=>
k=>v){
d
a
t
a
[
data[
data[k][‘cc_name’] = $v[‘cc_name’];
d
a
t
a
[
data[
data[k][‘money’] = $v[‘money’].“元”;
d
a
t
a
[
data[
data[k][‘c_time’] = date(“Y-m-d H:i:s”,$v[‘c_time’]);
d
a
t
a
[
data[
data[k][‘status’] = $v[‘status’]==2 ? “已发送红包” : “”;
}
t
i
t
l
e
=
a
r
r
a
y
(
′
姓
名
′
,
′
红
包
金
额
′
,
′
创
建
时
间
′
,
′
状
态
′
)
;
h
e
a
d
e
r
(
"
C
o
n
t
e
n
t
−
t
y
p
e
:
a
p
p
l
i
c
a
t
i
o
n
/
o
c
t
e
t
−
s
t
r
e
a
m
"
)
;
h
e
a
d
e
r
(
"
A
c
c
e
p
t
−
R
a
n
g
e
s
:
b
y
t
e
s
"
)
;
h
e
a
d
e
r
(
"
C
o
n
t
e
n
t
−
t
y
p
e
:
a
p
p
l
i
c
a
t
i
o
n
/
v
n
d
.
m
s
−
e
x
c
e
l
;
c
h
a
r
s
e
t
=
U
T
F
−
8
"
)
;
h
e
a
d
e
r
(
"
C
o
n
t
e
n
t
−
D
i
s
p
o
s
i
t
i
o
n
:
a
t
t
a
c
h
m
e
n
t
;
f
i
l
e
n
a
m
e
=
"
.
i
c
o
n
v
(
"
U
T
F
−
8
"
,
"
G
B
2312
/
/
I
G
N
O
R
E
"
,
d
a
t
e
(
′
Y
−
M
−
D
′
,
t
i
m
e
(
)
)
.
"
导
出
方
案
记
录
"
)
.
"
.
x
l
s
"
)
;
h
e
a
d
e
r
(
"
P
r
a
g
m
a
:
n
o
−
c
a
c
h
e
"
)
;
h
e
a
d
e
r
(
"
E
x
p
i
r
e
s
:
0
"
)
;
/
/
导
出
x
l
s
开
始
i
f
(
!
e
m
p
t
y
(
title=array('姓名','红包金额','创建时间','状态'); header("Content-type:application/octet-stream"); header("Accept-Ranges:bytes"); header("Content-type:application/vnd.ms-excel; charset=UTF-8"); header("Content-Disposition:attachment;filename=".iconv("UTF-8", "GB2312//IGNORE",date('Y-M-D',time())."导出方案记录").".xls"); header("Pragma: no-cache"); header("Expires: 0"); //导出xls 开始 if (!empty(
title=array(′姓名′,′红包金额′,′创建时间′,′状态′);header("Content−type:application/octet−stream");header("Accept−Ranges:bytes");header("Content−type:application/vnd.ms−excel;charset=UTF−8");header("Content−Disposition:attachment;filename=".iconv("UTF−8","GB2312//IGNORE",date(′Y−M−D′,time())."导出方案记录").".xls");header("Pragma:no−cache");header("Expires:0");//导出xls开始if(!empty(title)){
foreach ($title as $k => $v) {
t
i
t
l
e
[
title[
title[k]=iconv(“UTF-8”, “GB2312//IGNORE”,$v);
}
$title= implode("\t",
t
i
t
l
e
)
;
e
c
h
o
"
title); echo "
title);echo"title\n";
}
if (!empty(KaTeX parse error: Expected '}', got 'EOF' at end of input: … foreach(refInfo as
k
e
y
=
>
key=>
key=>val){
foreach ($val as $ck => $cv) {
r
e
f
I
n
f
o
[
refInfo[
refInfo[key][$ck]=iconv(“UTF-8”, “GB2312//IGNORE”, $cv);
}
r
e
f
I
n
f
o
[
refInfo[
refInfo[key]=implode("\t",
r
e
f
I
n
f
o
[
refInfo[
refInfo[key]);
}
echo implode("\n",$refInfo);
}
}
PHP导出Excel表格
最新推荐文章于 2024-04-27 20:16:32 发布