Created
December 18, 2015 22:05
-
-
Save hugsbrugs/bac6994a8823b572a712 to your computer and use it in GitHub Desktop.
PHP flush example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
ini_set('display_errors', 1); | |
ini_set('error_reporting', E_ALL); | |
/* permet d'aficher le contenu d'une page au fur et à mesure ... très bon pour le dev ou quand on veut suivre un process */ | |
header( 'Content-Encoding: none; ' );//disable apache compressed | |
@ini_set('zlib.output_compression', 0); | |
@ini_set('implicit_flush', 1); | |
ob_implicit_flush(1); | |
echo str_repeat(" ", 1024), "\n"; flush(); | |
echo 'Begin ... | |
'; | |
for( $i = 0 ; $i < 100 ; $i++ ) | |
{ | |
echo $i . ' | |
'; | |
flush(); | |
ob_flush(); | |
sleep(1); | |
} | |
echo 'End ... | |
'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment