CodeIgniter Forums
What does ob_get_level() > $this->ob_level + 1 mean? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: What does ob_get_level() > $this->ob_level + 1 mean? (/showthread.php?tid=71026)



What does ob_get_level() > $this->ob_level + 1 mean? - Andrei0872 - 06-27-2018

I know it might be a naive question, but I've found this piece of code in the Exceptions.php file and (with all the online documentation) I can't find a way to understand what this means.

PHP Code:
if (ob_get_level() > $this->ob_level 1)
        {
            
ob_end_flush();
        } 
I know it is something about "PHP output buffering mechanism", but it still doesn't make any sense to me.

Any help will be much appreciated.


RE: What does ob_get_level() > $this->ob_level + 1 mean? - ciadmin - 06-27-2018

This is bone-standard part of PHP provision for capturing output.
http://php.net/manual/en/book.outcontrol.php


RE: What does ob_get_level() > $this->ob_level + 1 mean? - dave friend - 06-27-2018

The Introduction page on Output Control in the PHP manual states:

Quote:The Output Control functions allow you to control when output is sent from the script. This can be useful in several different situations, especially if you need to send headers to the browser after your script has begun outputting data. The Output Control functions do not affect headers sent using header() or setcookie(), only functions such as echo and data between blocks of PHP code.


You may find this article makes the above statement clear.