導讀:DEDE技術DEDE技術1、首先在后臺修改/dede/templets/diy_main.htm a href=../plus/diy.php?action=daochudiyid={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網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_28736.html
為你推薦與一個DEDECMS自定義表單導出為excel功能的修改方法相關的文章
網站建設技術SEOUC.COM
專注網站建設,SEO優化,小程序設計制作搭建開發定制網站等,數千家網站定制開發案例,網站推廣技術服務。
5000+合作客服
8年從業經驗
150+覆蓋行業
主站蜘蛛池模板:
揭阳市|
永安市|
平安县|
惠水县|
丹阳市|
沅陵县|
湄潭县|
九江县|
岳阳市|
濮阳市|
扎赉特旗|
将乐县|
新乐市|
白水县|
衡山县|
黑龙江省|
天镇县|
潮州市|
关岭|
高安市|
和硕县|
仙桃市|
乳源|
赣州市|
建始县|
西林县|
保山市|
锡林郭勒盟|
盐山县|
阿荣旗|
禹州市|
大悟县|
汝城县|
乳山市|
苍南县|
武强县|
镇沅|
清原|
中卫市|
尉犁县|
汕头市|
|