我有一个HTML页面,它显示了一个进度条,它逐步完成一个进程。它使用flush()将数据发送到浏览器。我试图让这个在Zend进程中工作,我通过专门发送头文件,内容,然后用退出命令结束进程来短路。HTTP头差异 - 递增加载页面
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
而对于在Zend/PHP页面的标题出现为:
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');
我使用这个代码从该页面:http://w3shaman.com/article/php-progress-bar-script
任何帮助,将不胜感激。谢谢。
您是否尝试过使用'ob_flush()'以及'flush()'? Zend可以激活输出缓冲。 – Tchoupi 2012-07-27 15:11:48
要提炼@ MathieuImbert的观点 - 你需要在调用'flush()'之前调用'ob_flush()'**。 – DaveRandom 2012-07-27 15:19:23
我以前试过,它没有工作,但现在它是。我假设w3shaman.com中的方法是不同的。感谢您的修复。 – 2012-07-27 15:22:22