php导出csv或xls文件程序_PHP教程
include("../inc/connect.php");
$Date = date("Y-m-d");
$Filename = $Date.".csv";
$Table = isset($_GET['tid'])?$_GET['tid']:'';
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=".$Filename);
echo "用户名,真实姓名,联系方式,联系QQ,联系地址,邮箱地址 rn";
$Sql = "Select * from gx_member where datediff(m_time,'".date("Y-m-d H:i:s")."')
$Result = mysql_query($Sql);
while($rs = mysql_fetch_array($Result) ){
echo $rs['m_name'].','. $rs['m_realname'].",". $rs['m_tel'].",". $rs['m_qq'].",". $rs['m_address'].",". $rs['m_mail']." rn ";
}
?>
上面我们用的是导出csv文件还有一种就导出xls文件只要修改一下
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=".$Filename);
就差不多了.
本站原创转载请注明www.111cn.cn/phper/php.html
上一篇: 如何连接myeclipse和access
下一篇: 判断一个整数是不是2的整数次幂