else if($action == 'push') { $row = $dsql->GetOne("Select * From dede_diyforms where diyid='$diyid'"); $ds = file(('/dede/inc/fieldtype.txt')); foreach($ds as $d){ $dds = explode(',',trim($d)); $fieldtypes[$dds[0]] = $dds[1]; } $fieldset = $row['info']; $dtp = new DedeTagParse(); $dtp->SetNameSpace("field","<",">"); $dtp->LoadSource($fieldset); $titleArray=array(); $titleName=array(); if(is_array($dtp->CTags)){ foreach($dtp->CTags as $ctag) { $itname = $ctag->GetAtt('itemname'); if($itname=='') echo "没指定"; $titleArray[] = $itname; $titleName[]= $ctag->GetTagName(); } } header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename=demo.xls'); header('Pragma: no-cache'); header('Expires: 0'); $title =$titleArray; include_once DEDEINC.'/datalistcp.class.php'; if($diy->public == 2) $query = "SELECT * FROM `{$diy->table}` ORDER BY id DESC"; else $query = "SELECT * FROM `{$diy->table}` WHERE ifcheck=1 ORDER BY id DESC"; $datalist = new DataListCP(); $datalist->pageSize = 10; $datalist->SetParameter('action', 'list'); $datalist->SetParameter('diyid', $diyid); $datalist->SetSource($query); $rsArray = array(); $datalist->dsql->Execute('dlist',$datalist->sourceSql); $i = 0; while($arr=$datalist->dsql->GetArray('dlist')) { $i++; $object = array(); foreach ($titleName as $va){ $object[]=$arr[$va]; } $rsArray[$i] = $object; } $data = $rsArray; echo iconv('utf-8', 'gbk', implode("\t", $title)), "\n"; foreach ($data as $value) { echo iconv('utf-8', 'gbk', implode("\t", $value)), "\n"; } exit; } |
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: dede 自定义表单导出功能的实现详细步骤