如何检查是否已在PHP中设置header()?

use*_*729 4 php http-headers

到目前为止,PHP中是否有可能设置一些头信息?

Jos*_*h K 7

试试headers_sent().

关于headers_sent()的 PHP文档.

您还可以使用get_headers()检索页面的标题,并使用headers_list()列出它们.我有点困惑,你的意思是你想检查是否有类似的东西header("Location: /path/to/location");


小智 5

尝试使用header_list()来确定哪些标头已准备好发送到客户端。使用headers_sent()检查标头是否已发送到客户端。