【发布时间】:2013-12-24 12:18:32
【问题描述】:
我很难找出以下代码中的问题,我真的需要一个解决方案。
考虑以下代码:
<?php
//starting a new output buffer, with a GZIP compression
ob_start("ob_gzhandler");
//this goes into the buffer
echo "Hi";
//grabbing the buffer's content
$content = ob_get_contents();
//cleaning the buffer
ob_clean();
//we're still inside the buffer, show the content again
echo $content;
此代码无法输出“Hi”,而是看到“‹óÈM”,是什么破坏了正确的缓冲?知道一旦我删除“ob_gzhandler”,缓冲是正确的,一切都很好。我不想创建另一个缓冲区并销毁当前缓冲区。我只想使用 ob_clean 清理当前的。
有什么想法吗?提前致谢。
【问题讨论】:
-
我有正确的输出和你的代码....在我的本地主机上测试过
标签: php output-buffering