flush () can not be output sequentially Solution

If you are under linux, first confirm whether to add ob_start () and ob_flush ().

ob_start();

for ($i=1; $i<=10; $i++) {
        echo $i."<br />\n";
        ob_flush();
        flush();
        usleep(500000);
}

If this fails, then the output, in front of the header information code with

header("Content-Type:text/html;charset=utf8;");

ob_start();

for ($i=1; $i<=10; $i++) {
        echo $i."<br />\n";
       ob_flush();
    flush();
        usleep(500000);
}

 

Reproduced in: https: //www.cnblogs.com/caly/archive/2013/01/15/2860763.html

Guess you like

Origin blog.csdn.net/weixin_34327761/article/details/93538117