PHP - How Detect if Output Buffering is Turned On

*爱你&永不变心* 提交于 2019-11-28 12:13:55

You can check any INI setting in PHP with the ini_get method. http://php.net/ini_get

ini_get('output_buffering');

Likewise, you can change most INI settings with ini_set:

ini_set('output_buffering', 'on');

You can access the output_buffering value in the php.ini file by doing:

var_dump(ini_get('output_buffering'));

But I think what you are looking for is ob_get_level() (or ob_get_status()):

var_dump(ob_get_level());

Returns the level of nested output buffering handlers or zero if output buffering is not active.

simple

check by

echo ini_get('output_buffering');

or run a file calling phpinfo(); function it will list all veriables containing values check the value for 'output_buffering ' in list.

I think you can go

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