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