Quote:
Originally Posted by hinch
add this to a functions file or somewhere it can be referenced
PHP Code:
/** * Output buffer flusher * Forces a flush of the output buffer to screen useful for displaying long loading lists eg: bulk emailers on screen * Stops the end user seeing loads of just plain old white and thinking the browser has crashed on long loading pages. */ function fcflush() { static $output_handler = null; if ($output_handler === null) { $output_handler = @ini_get('output_handler'); } if ($output_handler == 'ob_gzhandler') { // forcing a flush with this is very bad return; } flush(); if (function_exists('ob_flush') AND function_exists('ob_get_length') AND ob_get_length() !== false) { @ob_flush(); } else if (function_exists('ob_end_flush') AND function_exists('ob_start') AND function_exists('ob_get_length') AND ob_get_length() !== FALSE) { @ob_end_flush(); @ob_start(); } }
|
Not that socket buffer sizes on a windows machine or an ISP can be overridden by PHP but you're still using flush() in your function - which as demonstrated already doesn't work.
Secondly I've just tried using it on my wamp setup and again, it doesn't work through a browser. I did however get it to work up to the 4th loop using a http debugging program.. which then froze. I tried another which did work upto and past 30 however no normal browser will work like this.
Finally if it doesn't work on localhost it certainly won't on a remote server with an ISP between it and the end user due to cache issues and socket buffers.
To put it mildly, your code is unstable.