Answer the question
In order to leave comments, you need to log in
How to display data immediately in php?
If you run this code in php
<?php
for ($i = 0; $i< 3; $i++)
{
echo $i. '<br>';
sleep(1);
}
Answer the question
In order to leave comments, you need to log in
Output control functions
<?php
header( 'Content-type: text/html; charset=utf-8' );
echo 'Begin ...<br />';
for( $i = 0 ; $i < 10 ; $i++ )
{
echo $i . '<br />';
flush();
ob_flush();
sleep(1);
}
echo 'End ...<br />';
?>
What you want doesn't need to be done over http, either use web-socket or move this functionality to the front entirely. Http is designed to receive data, not send signal commands from the server. Manipulations with ajax or buffer overflows will also be a perversion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question