且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法删除缓冲区。没有要删除的缓冲区

更新时间:2021-11-12 19:12:30

这个错误只是告诉你没有要删除的缓冲区。
为了避免它只使用:

That error is just telling you that there was no buffer to delete. To avoid it just use:

if (ob_get_contents()) ob_end_clean();

(检查是否有活动输出缓冲区)
或:

(check if there's an active output buffer) or:

if (ob_get_length()) ob_end_clean();

(检查缓冲区中是否有非空字符串)
@Venu建议。

(checks if there's a non empty string in the buffer) as suggested by @Venu.

也是你调用 ob_end_clean(); 两次。这只适用于可堆叠缓冲区。从PHP手册:

also you are calling ob_end_clean(); two times there. And that only works with stackable buffers. From the PHP manual:


此函数舍弃最顶层输出缓冲区的内容,
关闭此输出缓冲。

您确定不想只使用 ob_clean()