phpexcel 导出excel的时候 在服务器和 本地都同时导出了一份,为什么的我服务器上面的excel打开有数据,本地的打开是空白的,啥都没有啦
$param = [
'uid' => 2120872
];
$order = Jdbc::getMemberDate('new_order',$param,2);
$objPHPExcel = new \PHPExcel();
// 设置
$objSheet = $objPHPExcel->getActiveSheet();
// 设置表的title
$objSheet->setTitle("XXXXXXX");
// 遍历表列
$objSheet->setCellValue("A1","oid")
->setCellValue("B1","uid")
->setCellValue("C1","bespeak_store_id")
->setCellValue("D1","store_id")
->setCellValue("E1","cartid")
->setCellValue("F1",'order_number')
->setCellValue("G1",'price')
->setCellValue("H1",'order_time')
->setCellValue("I1",'good_number')
->setCellValue("J1",'type');
$j = 2;
foreach ($order as $k => $v){
$objSheet->setCellValue("A".$j,$v['oid'])
->setCellValue("B".$j,$v['uid'])
->setCellValue("C".$j,$v['bespeak_store_id'])
->setCellValue("D".$j,$v['store_id'])
->setCellValue("E".$j,$v['cartid'])
->setCellValue("F".$j,$v['order_number'])
->setCellValue("G".$j,$v['price'])
->setCellValue("H".$j,$v['order_time'])
->setCellValue("I".$j,$v['good_number'])
->setCellValue("J".$j,$v['type']);
$j++;
}
$file_name = "order订单统计表".date("Y-m-d",time()).".xls";
$response = $this->response();
$response->withHeader('Cache-Control','public');
$response->withHeader('Content-Type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$response->withHeader('Content-Type','application/octet-stream');
$response->withHeader('Content-Type','application/download');
$response->withHeader('Content-Transfer-Encoding','binary');
$response->withHeader('Last-Modified','' . gmdate("D, d M Y H:i:s") . 'GMT');
$response->withHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0');
$response->withHeader('Pragma','no-cache');
$response->withHeader('Content-Type','application/download');
$response->withHeader('Content-Disposition','attachment;filename='.$file_name.'');
$xlsWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$xlsWriter->save($file_name); // 'php://output'
本地没数据吧