为什么我需要结束我的ob_start()? [英] why do I need to end my ob_start()?

查看:158
本文介绍了为什么我需要结束我的ob_start()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

php文档建议我应该以ob_end_flush()结尾每个ob_start().我在网站的每一页上都使用一个,只是为了允许我在应用程序中的任何位置使用firephp日志方法.

The php documentation suggests that I should end each ob_start() with an ob_end_flush(). I am using one on each page of a site, just to allow me to use firephp log methods anywhere in the app.

该应用程序运行正常,但我想知道是否有我不知道的内容可能有害.

the app works fine, but I wonder if there is anything I don't know that might be detrimental.

推荐答案

我认为此建议的原因是,当不使用ob_end_*函数之一时,PHP会隐式刷新输出缓冲区.尽管不是错误,但 可能会导致一些问题,而并非期望. PHP文档试图保护您免受这类问题的困扰.如果您知道隐式刷新,则可能不是问题.

I think the reason for this suggestion is, that PHP flushes your output buffer implicitly when not using one of the ob_end_* functions. While not an error, this can cause problems when not expecting it. The PHP-docs try to protect you from these kind of problems. If you are aware of the implicit flush, it is probably not an issue.

这篇关于为什么我需要结束我的ob_start()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆