狀態碼的職責是當客戶端向服務器端發送請求時, 描述返回的請求結 果。 藉助狀態碼, 用戶可以知道服務器端是正常處理了請求, 還是出現了錯誤。
狀態碼的類別
類別 | 原因短語 |
---|---|
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 |