<?php
/*php导出程序要用用的程序*/
/*通过头部定义导出的格式*/
header("Content-type:application/vnd.ms-excel");
$date=date('Y-m-d');
header("Content-Disposition:filename=$date.xls");
/*填写导出的文件名称,这里是通过$date进行命名*/
/*php导出程序结束*/
require_once("conn_inc.php");
require_once("smarty_inc.php");
$id= $_REQUEST['id'];
$class_id= $_REQUEST['class_id'];
$query=mysql_query("select * from new_class as a,new_category as b where a.id='$id' and class_id='$class_id'");
$row=@mysql_fetch_array($query);
$id=$row['id'];
$title=$row['title'];
$categroy=$row['categroy'];
$content=$row['content'];
$date_time=$row['date_time'];
$smarty->assign("id",$id);
$smarty->assign("title",$title);
$smarty->assign("categroy",$categroy);
$smarty->assign("content",$content);
$smarty->assign("date_time",$date_time);
$smarty->assign("class_id",$class_id);
$smarty->display("new_dao.tpl.html");
?>
以下是模版的程序:
<html>
<head>
<title>{$title}</title>
</head>
<body>
<table border="1" align="center">
<tr>
<td>ID</td>
<td>{$id}</td>
</tr>
<tr>
<td>标题:</td>
<td>{$title}</td>
</tr>
<tr>
<td>栏目:</td>
<td>{$categroy}</td>
</tr>
<tr>
<td>内容:</td>
<td>{$content}</td>
</tr>
<tr>
<td>时间</td>
<td>{$date_time}</td>
</tr>
</table>
</body>
</html>