public function export() { Header( "Content-type: application/octet-stream "); Header( "Accept-Ranges: bytes "); Header( "Content-type:application/vnd.ms-excel "); Header( "Content-Disposition:attachment;filename=ExportDate.xls "); $where="1=1"; $date=$_POST["date_exp"]; if($date=="今天") { $time1 = strtotime(date("Y-m-d",time())); $time2 = $time1 + 3600*24; $where = $where." and `inputtime` between '$time1' and '$time2' "; } else if($date=="昨天") { $time1 = strtotime(date("Y-m-d",time())); $time2 = $time1 - 3600*24; $where =$where. " and `inputtime` between '$time2' and '$time1' "; } else if($date=="上周") { $now = time(); $date = $now - 7*24*60*60; $where=$where." and `inputtime` >= '$date' "; } else if($date=="最近30天") { $now = time(); $date = $now - 30*24*60*60; $where=$where." and `inputtime` >= '$date' "; } $this->db->set_model(12); //12对应于content模块对应的modelid $dates=$this->db->select($where,'*','','inputtime desc'); echo "ID \t 栏目\t 姓名 \t详细地址 \t QQ \t Email \t 电话 \t 手机 \t 发布日期 \n"; for ($i=0;$i
php如何把数据库的数据用excel导出,PHP将操作数据库得到的数据生成Excel导出
最新推荐文章于 2023-07-02 13:35:19 发布