自己写的一个导出的程序这里主要用到一下程序

<?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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值