1.导出有很多种,他有自带包的导出,但是如果你要导出7,8千的数据的话就有点困难,我最近发现一个导出可以到出1万的数据,好像只能导出csv格式的。
public function down_load($lists){
set_time_limit(0); ini_set(‘memory_limit‘,‘1024M‘); $arr = array(‘a‘,‘b‘,‘c‘,‘d‘,‘e‘,‘f‘,‘g‘,‘h‘,‘i‘,‘j‘,‘k‘,‘l‘,‘m‘,‘n‘); $data=‘序列号‘; foreach($arr as $_arr){ $data .= ‘,‘.$_arr; } $data .= "\n"; $i=0; foreach($lists as $key => $_list){ $i++; $data .=$i.‘,‘.$_list[‘account‘][0][‘business_department‘] .‘,‘.$_list[‘account‘][0][‘capital_platform‘].‘,‘.$_list[‘account‘][0][‘account‘].‘,‘.$_list[‘currency_type‘].‘,‘.$_list[‘begin_y‘].‘,‘ .$_list[‘begin_b‘].‘,‘.$_list[‘debit_y‘].‘,‘.$_list[‘debit_b‘].‘,‘.$_list[‘credit_y‘].‘,‘ .$_list[‘credit_b‘].‘,‘.$_list[‘end_y‘].‘,‘.$_list[‘end_b‘].‘,‘.$_list[‘year‘].‘,‘.$_list[‘month‘].","."".","."\n"; } ob_end_flush(); header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=订单明细报表.csv"); //“生成文件名称”=自定义 header(‘Cache-Control:must-revalidate,post-check=0,pre-check=0‘); header(‘Expires:0‘); header(‘Pragma:public‘); echo $data; exit;}
时间: 2024-10-24 18:53:49