简体   繁体   中英

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 .

Is it possible to get the message?

Under Apache, you may try with 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).

I don't think a definite general answer is possible without delving into the actual source code though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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