在PHP中删除标题 [英] Delete a header in PHP
问题描述
为了允许缓存一个PHP生成的文件,我想确保'Pragma:no-cache'头部是 not 设置的。但是,如何删除可能已经设置的头文件?
To allow caching a PHP generated file, I want to make sure, that the 'Pragma: no-cache' header is not set. However, how do I delete a possibly already set header?
也就是说,它可能是可能的, code> header('Pragma:no-cache'); 现在我想确定,头文件没有发送。
That is, it could be possible, that somewhere in the code someone wrote header('Pragma: no-cache');
and now I want to make sure, the header is not sent.
这样做是否足够:
Is it sufficient to do this:
header('Pragma:');
或者像 delete_header()
(这显然是无证或隐藏的)?
or is there something like delete_header()
(which would, apparently, be undocumented or well-hidden)?
推荐答案
header_remove(),因为php 5.3
header_remove() since php 5.3
header_register_callback()也即将推出
这篇关于在PHP中删除标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!