繁体   English   中英

使用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"在你要发送的文件的底部....而且可能是,它也会破坏了该文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM