Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php HTTP头差异-增量加载页面_Php_Zend Framework_Http Headers - Fatal编程技术网

Php HTTP头差异-增量加载页面

Php HTTP头差异-增量加载页面,php,zend-framework,http-headers,Php,Zend Framework,Http Headers,我有一个HTML页面,它在一个过程中显示一个进度条。它使用flush()将数据发送到浏览器。我试图在Zend进程中实现这一点,我通过专门发送一个标题、内容,然后用exit命令结束该进程来缩短该进程 HTML页面显示正确(进度条逐步完成)。Zend/PHP页面只显示完成的页面(而不是步骤)。我假设这是一个标题问题,因为方法(flush())是相同的 在Chrome中,HTML页面的标题显示为: HTTP/1.1 200 OK Date: Fri, 27 Jul 2012 14:38:07 GMT

我有一个HTML页面,它在一个过程中显示一个进度条。它使用flush()将数据发送到浏览器。我试图在Zend进程中实现这一点,我通过专门发送一个标题、内容,然后用exit命令结束该进程来缩短该进程

HTML页面显示正确(进度条逐步完成)。Zend/PHP页面只显示完成的页面(而不是步骤)。我假设这是一个标题问题,因为方法(flush())是相同的

在Chrome中,HTML页面的标题显示为:

HTTP/1.1 200 OK
Date: Fri, 27 Jul 2012 14:38:07 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8r DAV/2 PHP/5.3.2
X-Powered-By: PHP/5.3.2
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
HTTP/1.1 200 OK
Date: Fri, 27 Jul 2012 14:44:13 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8r DAV/2 PHP/5.3.2
X-Powered-By: PHP/5.3.2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-cache
Pragma: no-cache
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Zend/PHP页面的标题显示为:

HTTP/1.1 200 OK
Date: Fri, 27 Jul 2012 14:38:07 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8r DAV/2 PHP/5.3.2
X-Powered-By: PHP/5.3.2
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
HTTP/1.1 200 OK
Date: Fri, 27 Jul 2012 14:44:13 GMT
Server: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8r DAV/2 PHP/5.3.2
X-Powered-By: PHP/5.3.2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-cache
Pragma: no-cache
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
我在PHP中指定的唯一标题信息是:

header('Content-Type: text/html; charset=utf-8');
我正在使用此页面中的代码:


任何帮助都将不胜感激。谢谢。

在调用
flush()
之前先调用
ob\u flush()
,因为Zend可以激活输出缓冲。

Mathieu已经解决了问题。在Zend/PHP页面中的flush()之前添加ob_flush()修复了该问题。我不确定Zend是否按照建议激活了输出缓冲。

您是否尝试过使用
ob\u flush()
以及
flush()
?Zend可能激活了输出缓冲。要优化@MathieuImbert的点-在调用
flush()
之前,需要调用
ob\u flush()
。我以前尝试过,但它不起作用,但现在可以了。我假设w3shaman.com中的方法是不同的。谢谢你的修复。