导出数据

master
sunke 5 years ago
parent 18fdf80fa4
commit f0d28e81c4

@ -2439,7 +2439,7 @@ class DownloadController extends BaseController {
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages - 1; $i++) {
for($i = 1; $i <= $pages; $i++) {
foreach($data as $value) {
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
@ -2952,7 +2952,7 @@ class DownloadController extends BaseController {
->where($map)
->order('tab_spend.id desc')
->select();
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
@ -2967,6 +2967,7 @@ class DownloadController extends BaseController {
$accessNum = count($data1)?:0 ;
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages; $i++) {
$model = M('spend','tab_');
$data = $model
@ -3017,12 +3018,10 @@ class DownloadController extends BaseController {
$csvData["p_proinfo"] = $value1["p_proinfo"];
$csvData["proinfo"] = $value1["proinfo"];
$csvData["pay_time"] = $value1["pay_time"];
mb_convert_variables('GBK', 'UTF-8', $csvData);
fputcsv($fp, $csvData);
$xlsData[] = $csvData;
}
foreach($xlsData as $value) {
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($xlsData);
ob_flush();
flush();

Loading…
Cancel
Save