note 109001 added to function.ob-get-level

From: Date: Mon, 11 Jun 2012 23:04:10 +0000
Subject: note 109001 added to function.ob-get-level
Groups: php.notes 
Request: Send a blank email to php-notes+get-188531@lists.php.net to get a copy of this message
For users confused about getting "1" as a return value from ob_get_level at the beginning of a script: this likely means the PHP ini directive "output_buffering" is not set to off / 0. PHP automatically starts output buffering for all your scripts if this directive is not off (which acts as if you called ob_start on the first line of your script). If your scripts may end up on any server and you don't want end-users to have to configure their INI, you can use the following at the start of your script to stop output buffering if it's already started: <?php if (ob_get_level()) ob_end_clean(); ?> Alternatively, you can use the opposite if you always want to have an output buffer at the start of your script: <?php if (!ob_get_level()) ob_start(); ?> ---- Server IP: 192.41.42.26 Probable Submitter: 76.25.105.79 ---- Manual Page -- http://www.php.net/manual/en/function.ob-get-level.php Edit -- https://master.php.net/note/edit/109001 Del: integrated -- https://master.php.net/note/delete/109001/integrated Del: useless -- https://master.php.net/note/delete/109001/useless Del: bad code -- https://master.php.net/note/delete/109001/bad+code Del: spam -- https://master.php.net/note/delete/109001/spam Del: non-english -- https://master.php.net/note/delete/109001/non-english Del: in docs -- https://master.php.net/note/delete/109001/in+docs Del: other reasons-- https://master.php.net/note/delete/109001 Reject -- https://master.php.net/note/reject/109001 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188531) next »