时间:2021-07-01 10:21:17 帮助过:17人阅读
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")."')<=$Table order by id desc ";
$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
http://www.bkjia.com/PHPjc/630431.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630431.htmlTechArticle由于工作需要今天我们要把mysql数据库里面的数据导出到execel里面用,后来在网上找了一下原来这么简单,因csv文件只要以, 分开就OK了,下面我...