简体   繁体   English

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

[英]How to check whether header() has been set in PHP?

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

Try headers_sent() . 尝试headers_sent()

PHP docs on headers_sent() . 关于headers_sent()的 PHP文档。

You can also retrieve the headers for a page with get_headers() and list them with headers_list() . 您还可以使用get_headers()检索页面的标题,并使用headers_list()列出它们。 I'm a bit confused though, do you mean you want to check if something like header("Location: /path/to/location"); 我有点困惑,你的意思是你想检查是否像header("Location: /path/to/location"); has been called? 被称为?

Try using header_list() to determine what headers are ready to be sent to the client. 尝试使用header_list()来确定准备发送到客户端的标头。 Use headers_sent() to check if headers have been sent to the client. 使用headers_sent()检查标头是否已发送到客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM