PHPExcel格式不正确

你好我试图通过Ajax生成和下载excel文件,但不幸的是我得到这个错误not well-formed ,没有更具体的..我已经检查了所有的variables等,我敢肯定,有没有缺less任何所需的值..所以基本上这是调用PHPExcel脚本的代码..

 $("#myForm").submit(function(e) { var group_id = <?php echo $group_id; ?>; var month = <?php echo $month; ?>; var year = <?php echo $year; ?>; $.ajax({ url: 'ajax/events_to_excel.php?id='+group_id+'&m='+month+'&y='+year, type: 'POST', data: $(this).serialize(), success: function(data, textStatus, jqXHR) { //console.log(data); }, error: function(jqXHR, textStatus, errorThrown) { } }). done(function(data) { }); e.preventDefault(); }); 

这是生成Excel文档的结尾标题代码(我不会显示所有以前的代码,因为我知道有一切正常,没有错误,已经检查和工作在不同的页面)唯一的部分,这里给出的错误是标题信息

 // Redirect output to a client's web browser (Excel2007) header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d MYH:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); ob_end_clean(); $objWriter->save('php://output'); exit; 

PS此页面不提供任何输出。