简体   繁体   English

HTTP状态代码是否始终是get_headers()中的第一个值?

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

Questions regarding the get_headers() php function: 有关get_headers()php函数的问题:

  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? 我注意到页面发送的HTTP状态代码排在第一位-始终是给定的吗?

Yes. 是。 That's a given. 那是给定的。

It reads the http headers from top top bottom, and a response always starts with the status line. 它从上到下读取HTTP标头,并且响应始终从状态行开始。

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 您可以在此处阅读有关HTTP响应的更多信息: https : //www.w3.org/Protocols/rfc2616/rfc2616-sec6.html

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

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