ob_get_level() starts at level 1

点点圈 提交于 2019-11-29 14:05:14

You have output buffering enabled by default (see the docs) - that basically means that every PHP script starts with ob_start().

If you want to disable the default OB for all PHP scripts, in your php.ini, set output_buffering = Off.

If you only want to disable the default OB for this specific script, use the while loop - it's quite correct.

As for the ob_clean - are you sure you want to delete the output that's in your buffer? IMO it's not really necessary, unless you are seeing significant slow page loads. Don't worry about optimizing that (at least not now).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!