使用phpexcel保存pdf将终止脚本的其余部分


saving the pdf using phpexcel terminate the rest of the script

echo语句没有运行,下面的脚本也没有运行

header("HTTP/1.1 200 OK");
                header("Pragma: public");
                header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                header("Cache-Control: private", false);
                header('Content-Type: application/pdf');
                header('Content-Disposition: attachment;filename="rename.pdf"'); //tell browser what's the file name
                header('Cache-Control: max-age=0'); //no cache
                $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
                $objWriter->setSheetIndex($i);
                $objWriter->save('php://output');
               echo "this is not diplaying"; //code get terminated

当您用文件头向php://output发送数据时,不要回显任何内容。。。。echo将其数据发送到php://output。。。。。您所要做的就是在发送的文件的底部写入"this is not diplaying"。。。。并且很可能它也会损坏文件