最新活动:电脑PC端+手机端+微网站+自适应网页多模板选择-建站388元起价!!!
当前位置:主页 > 网站建设 > 一个DEDECMS自定义表单导出为excel功能的修改方法

一个DEDECMS自定义表单导出为excel功能的修改方法

时间:2023-07-17 11:07:17 阅读: 文章分类: 网站建设 作者: dede技术员

导读:DEDE技术DEDE技术1、首先在后台修改/dede/templets/diy_main.htm a href=../plus/diy.php?action=daochudiyid={dede后台模板织梦模板。

dede后台模板织梦模板1、首先在后台修改/dede/templets/diy_main.htm   <a href="../plus/diy.php?action=daochu&diyid={dede:field.diyid/}" target="_blank">导出为EXCEL</a>   修改,后台效果织梦模板网站如下图:   2、核心内容修改  plus/diy.php   $action = isset($action) && in_array($action, array('post', 'list', 'view')) ? $action : 'post'; 替换成:   $action = isset($action) && in_array($action, array('post', 'list', 'view', 'daochu')) ? $action : 'post'; 再在最后一行下面新加代码:   当然,下面输出表头的判断语句你可以自己改!  else if($action == 'daochu') { header("Content-type:application/vnd.ms-excel"); Header("Content-Disposition:attachment;filename={$diy->table}_".date("Y-m-d").".xls"); $query = "desc `{$diy->table}`"; $res = mysql_query($query); echo "<table><tr>"; //导出表头(也就是表中拥有的字段) while($row = mysql_fetch_array($res)){ $t_field[] = $row['Field']; //Field中的F要大写,否则没有结果 /* echo "<th>".$row['Field']."</th>"; */ if($row['Field']=='id'){ echo "<th>ID</th>"; }elseif($row['Field']=='zhaiwutype'){ echo "<th>债务类型</th>"; }elseif($row['Field']=='zhaiquanfang'){ echo "<th>债权方</th>"; }elseif($row['Field']=='name'){ echo "<th>名称</th>"; }elseif($row['Field']=='jigouhaoma'){ echo "<th>身份证号/机构代码</th>"; }elseif($row['Fiel织梦手机模板d']=='path'){ echo "<th>住址/地址</th>"; }elseif($row['Field']=='tel'){ echo "<th>联系电话</th>"; }elseif($row['Field']=='zhaiwufang'){ echo "<th>债务方</th>"; }elseif($row['Field']=='zhaiwufangname'){ echo "<th>债务方名称</th>"; }elseif($row['Field']=='zhaiwufanghaoma'){ echo "<th>债务方身份证号/机构代码</th>"; }elseif($row['Field']=='zhaiwufangpath'){ echo "<th>债务方地址</th>"; }elseif($row['Field']=='zhaiwufangtel'){ echo "<th>债务方电话</th>"; }elseif($row['Field']=='danbaofang1'){ echo "<th>担保方</th>"; }elseif($row['Field']=='danbao1name'){ echo "<th>担保方名称</th>"; }elseif($row['Field']=='danbao1haoma'){ echo "<th>身份证号/机构代码</th>"; }elseif($row['Field']=='danbao1tel'){ echo "<th>联系电话</th>"; }elseif($row['Field']=='zhaiwushuoming'){ echo "<th>债务说明</th>"; }elseif($row['Field']=='fayuanzhixing'){ echo "<th>法院是否强制执行</th>"; }elseif($row['Field']=='zhixingfayuan'){ echo "<th>执行法院</th>"; }elseif($row['Field']=='lianxiren'){ echo "<th>联系人</th>"; }elseif($row['Field']=='lianxidianhua'){ echo "<th>电话</th>"; }elseif($row['Field']=='zhaiwujine'){ echo "<th>债务金额</th>"; }elseif($row['Field']=='nativeplace1'){ echo "<th>住址/地址</th>"; }elseif($row['Field']=='jiamengtype'){ echo "<th>加入类型</th>"; }elseif($row['Field']=='groupname'){ echo "<th>公司(机构)名称</th>&q织梦模板下载uot;; }elseif($row['Field']=='grouppath'){ echo "<th>公司地址</th>"; }elseif($row['Field']=='groupjianjie'){ echo "<th>公司简介</th>"; }elseif($row['Field']=='lianxiren'){ echo "<th>联系人</th>"; }elseif($row['Field']=='lianxitel'){ echo "<th>联系电话</th>"; }elseif($row['Field']=='lianximobile'){ echo "<th>手机</th>"; }elseif($row['Field']=='qq'){ echo "<th>QQ</th>"; }elseif($row['Field']=='name'){ echo "<th>姓名</th>"; }elseif($row['Field']=='xingbie'){ echo "<th>性别</th>"; }elseif($row['Field']=='nianling'){ echo "<th>年龄</th>"; }elseif($row['Field']=='danwei'){ echo "<th>工作单位</th>"; }elseif($row['Field']=='zhiwu'){ echo "<th>职务</th>"; }elseif($row['Field']=='dianhua'){ echo "<th>联系电话</th>"; }elseif($row['Field']=='mobile'){ echo "<th>手机</th>"; }elseif($row['Field']=='mail'){ echo "<th>E-mail</th>"; }elseif($row['Field']=='ifcheck'){ echo "<th> </th>"; }else{ echo "<th> </th>"; } } echo "</tr>"; //导出数据 $sql = "select * from `{$diy->table}`"; $res = mysql_query($sql); while($row = mysql_fetch_array($res)){ echo "<tr>"; foreach($t_field as $f_key){ echo "<td>".$row[$f_key]."</td>"; } echo "</tr>"; } echo "</table>"; }

关键词标签: CMS 自定义 表单

声明: 本文由我的SEOUC技术文章主页发布于:2023-07-17 ,文章一个DEDECMS自定义表单导出为excel功能的修改方法主要讲述自定义,表单,CMS网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_28736.html

我的IDC 网站建设技术SEOUC.COM
专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
  • 5000+合作客服
  • 8年从业经验
  • 150+覆盖行业
  • 最新热门源码技术文章