当我在 Apache + mod_php5 中设置自定义 header 时,效果很好:
header('Foo: Bar');
但是当我尝试此操作时同时还发送了 304 Not Modified 响应, header 似乎已被 apache 删除(连同 X-Powered-By 和其他标准 header )。
header('HTTP/1.1 304 No Content');
header('Foo: Bar');
有谁知道如何解决这个问题?
最佳答案
这不是回答问题吗?
If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers.
来自 http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5
关于php - Apache 在发送 304 时忽略 PHP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6491419/