PHP冲洗不工作 [英] php flush not working

查看:62
本文介绍了PHP冲洗不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php
for($i=0;$i<20;$i++)
{
    echo 'printing...<br />';
    ob_flush();
    flush();

    usleep(300000);
}

?>

包含以下代码的网址: http://domainsoutlook.com/sandbox/delayed.php

Url that contains the code: http://domainsoutlook.com/sandbox/delayed.php

我有专用的服务器,因此可以进行更改.我正在运行apache和nginx作为代理服务器.

I have a dedicated server so I can make the changes. I am running apache and nginx as the proxy server.

推荐答案

您正在使用ob_flush而没有ob_start,因此没有需要冲洗的东西.

You're using ob_flush without ob_start, so there is nothing to flush for it.

这还取决于Web服务器和代理及其设置.

It also depends on the webserver and proxy and its settings.

您应禁用Nginx的缓冲(将proxy_buffering off;添加到配置文件并重新启动Nginx)

You should disable buffering for Nginx (add proxy_buffering off; to the config file and restart Nginx)

还要检查您的 php.ini 是否包含output_buffering = Offzlib.output_compression = Off.

Also, check if your php.ini contains output_buffering = Off and zlib.output_compression = Off.

这篇关于PHP冲洗不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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