function districtexcelpdf(){
ob_start();
require_once('districtexcel.php');
$objPHPExcel = new PHPExceldis();
$objPHPExcel->districtExcel();
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="District_report.xls"');
header('Cache-Control: max-age=0');
header('Cache-Control: max-age=1');
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header ('Cache-Control: cache, must-revalidate');
header ('Pragma: public');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
ob_clean();
$objWriter->save('php://output');
exit();
}
在上面的代码中我得到了一个不可读的角色。解决此问题所需的帮助。
答案 0 :(得分:0)
ob_clean();在开始时因为它发送垃圾值然后使用ob_start();最后是ob_clean();