when phpexcel exports excel, both the server and the local file are exported. Why does the excel on my server have data, the local one is blank, and there is nothing left?
$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"]);
$jPP;
}
$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"