php - 显示缓冲区和 otput tfpdf 文件
问题描述
下面非常简化的一段代码显示了我的情况。
if($pdf_success) {
echo 'Success! Your download is starting';
ob_end_clean()
$pdf->Output('D', 'filename.pdf');
} else {
echo 'Failure! Try again with different parameters.';
}
这是问题所在:
如果我不use ob_end_clean()
pdf 下载失败并显示以下消息:
Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file (output started at .....
如果我使用它,pdf 下载/显示正确,但消息不显示...
Using firstob_end_flush()
会显示消息,但会停止下载并显示相同的消息,而 usingob_end_clean()
无济于事,但会出现消息:
PHP Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in ....
如何同时显示一条消息,然后成功开始下载???
谢谢。
解决方案
推荐阅读
- python - 为什么在类中调用另一个函数时会收到“名称未定义”错误消息?
- c++ - 结构的 std::vector:调整矢量大小后结构成员的初始值是多少?
- formatting - man – 我怎样才能使单词斜体的一部分?
- java - 3的中位数比java中通常的快速排序花费更多时间
- java - 如何在 JAX-RS 中使数据字段成为可选(非必需)?
- github - 如何强制工程师使用同步的 fork 分支
- python - 具有多种状态的 Pygame 动画
- spring - Spring Cloud数据流如何实现多租户数据库
- javascript - 文本对齐“中心”不适用于表头
- node.js - 有没有办法在 Dialogflow 中检索对话历史记录?