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

使用phpexcel保存pdf将终止脚本的其余部分,php,phpexcel,dompdf,Php,Phpexcel,Dompdf,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); hea

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
。。。。。您所做的只是在要发送的文件底部写入
“这不是DIPLAY”
。。。。很可能它也会损坏该文件

当您向
发送数据时,不要回显任何内容php://output
带有文件头。。。。echo将其数据发送到
php://output
。。。。。您所做的只是在要发送的文件底部写入
“这不是DIPLAY”
。。。。很可能它也会损坏该文件

是的。。。。。在将文件输出到浏览器时,永远不要回显任何其他内容。。。。。这不是特定于PHPExcel的,它适用于生成或写入的任何文件php://output 由PHP。。。。您只能向浏览器发送一种内容类型以响应一个请求Yes。。。。。在将文件输出到浏览器时,永远不要回显任何其他内容。。。。。这不是特定于PHPExcel的,它适用于生成或写入的任何文件php://output 由PHP。。。。您只能向浏览器发送一种内容类型以响应一个请求