PHPExcel不下载xls

Saw many similar questions but nothing helped. I use PHPExcel. I tried

$filename = "report.xls";
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=".$filename);
header("Cache-Control: max-age=0");
header("Content-Type: application/octet-stream");
header("Content-Description: File Transfer");
header("Content-Transfer-Encoding: Binary");
$objWriter = PHPExcel_IOFactory::createWriter($pExcel, 'Excel5');
$objWriter->save("php://output");

and this

$filename = "report.xlsx";
    header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
    header("Content-Disposition: attachment; filename=\"".$filename."\"");
    header("Cache-Control: max-age=0");
    header("Content-Type: application/octet-stream");
    header("Content-Description: File Transfer");
    header("Content-Transfer-Encoding: Binary");
    $objWriter = PHPExcel_IOFactory::createWriter($pExcel, 'Excel2007');
    $objWriter->save("php://output");

But it shows in browser "PKoCjKG�D�X�[Content_Types].xml��MN�0���"" like this and doesnt force to download.

change filename to $filename, if you determine it before. Example:

require_once 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename='.$filename);
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');

It's work for me.

header("Content-Type: application/vnd.ms-excel; charset=UTF-8");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=output.xls");

Try to Replace

header("Content-Type: application/vnd.ms-excel; charset=utf-8");

With

header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');

I faced similar (Not exact) issue and fixed it from above mentioned code, Also I used it Here .