我需要禁用发送内容长度,并在头中进行其他不同的设置。如何在LAMP配置上执行?
总之,我需要把它变成这样
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Type:text/html
Date:Tue, 21 Jul 2015 05:58:49 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=15, max=97
Pragma:no-cache
Server:Apache
Transfer-Encoding:chunked
但是现在我有了这个
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Language:ru-RU
Content-Length:2640
Content-Type:text/html; charset=utf-8
Date:Tue, 21 Jul 2015 05:58:44 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=95
Pragma:no-cache
Server:Apache/2.2.22 (Debian)
Vary:Accept-Encoding
X-Powered-By:PHP/5.4.41-0+deb7u1
假设您希望在PHP中完成此操作(我从标题中猜测您正在使用PHP),您需要告诉httpd编码是分块的:
<?php
header("Transfer-encoding: chunked");
flush();
?>
这已经解决了以前的SO:如何使PHP生成块响应
虽然您可以在PHP中这样做,但我建议您不要在静态文件中这样做,因为这会破坏协议的整体意义。