Copyright 2013-2014 All Rights Reserved Theme by www.tbwwir.cn 版權(quán)所有
AB模板網(wǎng)(www.tbwwir.cn)專注企業(yè)網(wǎng)站模板制作,包括企業(yè)pbootcms網(wǎng)站模板,靜態(tài)網(wǎng)頁模板,網(wǎng)站源碼下載,HTML網(wǎng)站模板等等。XML地圖 網(wǎng)站地圖 今日更新
免責(zé)聲明:本站所有資源(模板、圖片)搜集整理于互聯(lián)網(wǎng)或者網(wǎng)友提供,僅供學(xué)習(xí)與交流使用,如果不小心侵犯到你的權(quán)益,請及時聯(lián)系我們刪除該資源。
視頻鏈接:https://www.ixigua.com/i6847795536586605067/
為了方便查看更多的開發(fā)教程,也可以掃碼關(guān)注我們,請用今日頭條APP掃碼關(guān)注
不寫死任何字段,不寫死任何東西,修改2個文件,讓織夢自定義表單自由導(dǎo)出到Excel表格里。
導(dǎo)出的excel文件請用wps軟件打開,office軟件下好像會亂碼。
1、/dede/templets/diy_main.htm
找到 前臺預(yù)覽</a>
在它的下面加入一行
| <a href="diy_list.php?action=excel&diyid={dede:field.diyid/}" target="_blank">導(dǎo)出表單Excel</a>
2、/dede/diy_list.php 找到
array('post', 'list', 'edit', 'check', 'delete'))
改成
array('post', 'list', 'edit', 'check', 'delete', 'excel'))
3、繼續(xù)找到
else
{
showmsg('未定義操作', "-1");
}
在它的上面加入
在它的上面加入
else if($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($fieldlist as $field=>$fielddata)
{
echo "<th>{$fielddata[0]}</th>";
}
echo "<th>狀態(tài)</th>";
echo "</tr>";
$sql = "SELECT * FROM {$diy->table} ORDER BY id DESC";
$dsql->SetQuery($sql);
$dsql->Execute('t');
while($arr = $dsql->GetArray('t'))
{
echo "<tr>";
foreach($fieldlist as $key => $field)
{
echo "<td>".$arr[$key]."</td>";
}
$status = $arr['ifcheck'] == 1 ? '已審核' : '未審核';
echo "<td>".$status."</td>";
echo "</tr>";
}
echo "</table>";
}
完成
}
完成