简体   繁体   English

如何获取PHP中http_response_code设置的状态信息

[英]How to get the status message set by http_response_code in PHP

The http_response_code function sets the header to the defined code and corresponding message from this map http_status_codes.h . http_response_code function 将 header 设置为定义的代码和来自此 map http_status_codes.h的相应消息。

Is it possible to get the message?是否有可能收到消息?

Under Apache, you may try with apache_request_headers() .在 Apache 下,您可以尝试使用apache_request_headers() Otherwise, that information might well not be available at all (ie sent directly to whatever HTTP serving tier is there, out-of-band and unseen from ob_* functions).否则,该信息可能根本不可用(即直接发送到任何 HTTP 服务层,带外且从 ob_* 函数中看不到)。

I don't think a definite general answer is possible without delving into the actual source code though.不过,如果不深入研究实际的源代码,我认为不可能有一个明确的通用答案。

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

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