为什么我需要使用许多刷新函数来刷新输出缓冲区(使用wamp,PHP) [英] Why do I need to use many flushing functions to flush the output buffer (using wamp, PHP)

查看:91
本文介绍了为什么我需要使用许多刷新函数来刷新输出缓冲区(使用wamp,PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在wamp服务器中,除非使用以下功能,否则无法刷新输出缓冲区:

In wamp server, I cannot flush the output buffer unless I use these functions:

ob_end_flush();
ob_flush();
flush();
ob_start();

为什么需要使用所有这些功能?
为什么简单的 ob_flush()无法正常工作?
我的代码:

Why do I need to use all of these functions? Why does simple ob_flush() is not working? my code :

<?php    
ob_start();
    header( 'Content-type: text/html; charset=utf-8' );
    echo 'Begin ...<br />';
    for( $i = 0 ; $i < 6 ; $i++ )
    {
        echo $i . '<br />';
        sleep(1);
        ob_end_flush();
        ob_flush();
        flush();
        ob_start();
    }
    echo 'End ...<br />';
    ?>


推荐答案

因为默认情况下您具有参数 output_buffering = on

Because you have by default parameter output_buffering = on

转到 C:\wamp \bin\php\php5.4.3\php.ini

并找到行

output_buffering =开启

并将其更改为

; output_buffering =开启

这篇关于为什么我需要使用许多刷新函数来刷新输出缓冲区(使用wamp,PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆