简体   繁体   中英

Is the HTTP status code always the first value in get_headers()?

Questions regarding the get_headers() php function:

  1. The function presents the headers in an array - is there any set order as to which header goes first?
  2. I noticed that the HTTP status code sent by the page goes first - is that always a given?

Yes. That's a given.

It reads the http headers from top top bottom, and a response always starts with the status line.

The first line of a Response message is the Status-Line, consisting of the protocol version followed by a numeric status code and its associated textual phrase...

You can read more about HTTP responses here: https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

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