ob_get_clean() 的输出被截断为 1024 个字符?
我正在处理别人的代码,大约有 800 行标记与标签混合在一起。我正在尝试将一些模板应用到这些页面,我想我应该首先捕获输出缓冲区中的所有输出,将其作为变量返回,然后逐段排序。
问题是,在缓冲区末尾,当我将输出作为字符串返回时,它会被截断为 1024 个字符。为什么会这样呢?
I'm working on someone elses code and there is ~800 lines of markup mixed in with tags. I'm trying to apply some templates to these pages and I thought I would start by capturing all the output in an output buffer, return that as a variable and then sort things out piece by piece.
The problem is that at the end of the buffer when I return the output as a string it is truncated at 1024 characters. Why would this be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常情况下,它不会这样做,这可能意味着:
ob_start($callback)
搞乱了事情(ob_get_level
说什么?) 。这三个就差不多了,没有代码就没什么可说的了。
Normally, it doesn't do that, which could mean:
ob_start($callback)
with a specific callback active messing things up (what doesob_get_level
say?).ob_get_clean()
Those 3 are about it, without code there isn't much else to say.
这 1024 字节可能不是输出的开头。某些内容可能已经通过输出缓冲区。出于测试目的,请尝试:
同时使用
ob_get_flush()< 进行测试/code>
相反。如果所有其他方法都失败,请使用自定义 ob_ 处理程序。
These 1024 bytes might not be the beginning of the output. Some content might already have passed the output buffer. For testing purposes try:
Also test with
ob_get_flush()
instead. If all else fails, use a custom ob_ handler.