时间:2021-07-21人气:-
效果展示:
(此图片来源于网络,如有侵权,请联系删除! )
前台预览</
a
>
在它的下面加入一行
<
a
href
=
"diy_list.php?action=excel&diyid={dede:field.diyid/}"
target
=
"_blank"
>导出表单Excel</
a
>
2、dedediy_list.php 找到
else
{
showmsg('未定义操作',"-1");
}
在它的上面加入
elseif($action=='excel')
{
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:attachment;filename={$diy->name}_".date("Y-m-d").".xls");
$fieldlist=$diy->getFieldList();
echo"<
table
><
tr
>";
foreach($fieldlistas$field=>$fielddata)
{
echo"<
th
>{$fielddata[0]}</
th
>";
}
echo"<
th
>状态</
th
>";
echo"</
tr
>";
$sql="SELECT*FROM{$diy->table}ORDERBYidDESC";
$dsql->SetQuery($sql);
$dsql->Execute('t');
while($arr=$dsql->GetArray('t'))
{
echo"<
tr
>";
foreach($fieldlistas$key=>$field)
{
echo"<
td
>".$arr[$key]."</
td
>";
}
$status=$arr['ifcheck']==1?'已审核':'未审核';
echo"<
td
>".$status."</
td
>";
echo"</
tr
>";
}
echo"</
table
>";
}