siddscool19 Posted April 19, 2009 Share Posted April 19, 2009 I want to know how to use ob_flush() and flush().. I am testing this code: <HTML> <BODY> This page is loading.<br /> <?php ob_flush(); flush(); sleep(10); ?> Almost there...<br /> <?php ob_flush(); flush(); sleep(10); ?> Done.<br /> </BODY> </HTML> But it is not giving me the desired output in firefox Am I wrong in using it or it doesn't work with firefox ? Quote Link to comment https://forums.phpfreaks.com/topic/154735-ob_flush-and-flush-how-to-use/ Share on other sites More sharing options...
thebadbad Posted April 19, 2009 Share Posted April 19, 2009 Your script actually works like intended when I run it in Firefox 3.0.8 on PHP 5.2.6. But you're supposed to turn on output buffering with ob_start(). Maybe that'll do it: <?php ob_start(); ?> <HTML> <BODY> This page is loading.<br /> <?php ob_flush(); flush(); sleep(10); ?> Almost there...<br /> <?php ob_flush(); flush(); sleep(10); ?> Done.<br /> </BODY> </HTML> Server settings can also play a part here. And remember that browsers also handle output buffering differently. Quote Link to comment https://forums.phpfreaks.com/topic/154735-ob_flush-and-flush-how-to-use/#findComment-813715 Share on other sites More sharing options...
PFMaBiSmAd Posted April 19, 2009 Share Posted April 19, 2009 It does not work because php, your web server, and your browser combination are doing buffering and/or compression and/or and minimum length block content rendering. You need to refresh the browser or use AJAX to get piecemeal content to be sent to and displayed in a browser that will work for all php/web server/browser combinations and configurations - http://www.phpfreaks.com/forums/index.php/topic,248507.msg1163558.html#msg1163558 Quote Link to comment https://forums.phpfreaks.com/topic/154735-ob_flush-and-flush-how-to-use/#findComment-813718 Share on other sites More sharing options...
siddscool19 Posted April 19, 2009 Author Share Posted April 19, 2009 Hey dude I found the problem it was due to antivirus. My antivirus was blocking it some way i don't know but when i switched off it worked and when i switched on it stopped. So it was due to antivirus. Quote Link to comment https://forums.phpfreaks.com/topic/154735-ob_flush-and-flush-how-to-use/#findComment-813724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.