返回首页
当前位置: 主页 > 网络编程 > Php实例教程 >

php、mysql导出excel数据

时间:2018-11-24 22:31来源:知行网www.zhixing123.cn 编辑:麦田守望者

//搜索
$start_time = strtotime($start_date);
$end_time = strtotime($end_date);
$sql = "select a.*,b.order_amount,b.money_paid from ".$ecs->table('invoice')." as a ".
" left join ".$ecs->table('order_info')." as b on a.order_id=b.order_sn".
" where a.add_time >=".$start_time." and a.add_time <=".$end_time." ";
$temp_list = $db->getAll($sql);

if($temp_list){//有数据
$Html='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><body>'.chr(13).chr(10);
$Html.='<table width="700" border="1" align="center" cellpadding="2" cellspacing="1">
<tr align="center">
<td align="center" nowrap="nowrap">时间:</td>
<td align="center" nowrap="nowrap" colspan="9">'.$start_date.'~'.$end_date.'</td>
</tr>
<tr align="center">
<td align="center" nowrap="nowrap">编号