Home > php教程 > php手册 > body text

基于flush()不能按顺序输出时的解决办法

WBOY
Release: 2016-06-13 11:44:42
Original
827 people have browsed it

如果是在linux下, 首先确认是否添加 ob_start() 和 ob_flush().

复制代码 代码如下:


ob_start();
for ($i=1; $i        echo $i."
\n";
        ob_flush();
        flush();
        usleep(500000);
}


如果还是不能输出的话, 就在代码前面加上头信息

复制代码 代码如下:


header("Content-Type:text/html;charset=utf8;");
ob_start();
for ($i=1; $i        echo $i."
\n";
       ob_flush();
    flush();
        usleep(500000);
}

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!