1
保存文件時,我有一個與我的PHPExcel混淆。 這是我的代碼Probloem保存到Excel使用PHPExcel PHP
$filename = 'test';
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$template = 'C:/xampp5.9/htdocs/MTD/assets/media/template/test.xls';
$objPHPExcel = $objReader->load($template);
$objPHPExcel->getSheet(0)->mergeCells('A9:B9')->setCellValue('A9', 'Test');
$rows = 15;
$col = 0;
$dt_download = ['rizky', 'Arie', 'Ester'];
for ($i=0; $i < COUNT($dt_download); $i++) {
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col+$i, $rows+$i, $dt_download[$i]);
}
$objPHPExcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$filename.'.xls"');
header('Cache-Control: max-age=0');
$objWriter->save('php://output');
exit();
並沒有什麼文件來作爲一個下載的文件。請告訴我如何解決它,因爲我在控制檯中的代碼中沒有任何錯誤。
我使用POST方法這個
安裝在你的系統是什麼版本的PHP? – MiltoxBeyond
我的PHP版本是'PHP版本5.6.19' –
在你的PHP錯誤日誌中的任何警告? – MiltoxBeyond