状态码的职责是当客户端向服务器端发送请求时, 描述返回的请求结 果。 借助状态码, 用户可以知道服务器端是正常处理了请求, 还是出现了错误。
状态码的类别
类别 | 原因短语 |
---|---|
1XX | Informational(信息性状态码) |
2XX | Success(成功状态码) |
3XX | Redirection(重定向状态码) |
4XX | Client Error(客户端错误状态码) |
5XX | Server Error(服务器错误状态码) |
类别 | 状态码 | 原因短语 |
---|---|---|
2XX | 200 | OK |
204 | No Content | |
206 | Partial Content | |
3XX | 301 | Moved Permanently |
302 | Found | |
303 | See Other | |
304 | Not Modified | |
307 | Temporary Redirect | |
4XX | 401 | Bad Request |
403 | Forbidden | |
404 | Not Found | |
5XX | 500 | Internal Server Error |
503 | Service Unavailable |