Home > Common Problem > body text

What is the use of HTTP status codes?

coldplay.xixi
Release: 2020-06-30 18:05:24
Original
3010 people have browsed it

The purpose of the HTTP status code is to use the Web Server to tell the client what happened to the current web page request, or the response status of the current Web server, so the HTTP status code is often used to judge and analyze the current The health of the web server.

What is the use of HTTP status codes?

The use of HTTP status code:

The core function of http status code is used by the Web Server to tell the client end, what happened to the current web page request, or the response status of the current web server. Therefore, HTTP status codes are often used to determine and analyze the current operating status of the web server.

As programmers, we need to know as much as possible about these status codes, and understand these status codes one by one. When we encounter them at work, we can understand where the problem lies and how to target it. of solving problems.

Related learning recommendations: PHP Programming from beginner to proficient

Commonly used http status codes:

  • 200 OK Server Request successfully processed (this is what we see most)

  • 301/302 Moved Permanently (Redirect) The requested URL has been moved. The Response should contain a Location URL, indicating the current location of the resource

  • 404 Not Found(Page Lost) The resource was not found

  • 501 Internal Server ErrorThe server encountered an error that prevented it from serving the request

Summary of common HTTP status codes :

1, starting with 1: (Accepted, need to continue processing.)

This type of status code means that the request has been accepted and needs to continue processing. This type of response is a temporary response, containing only a status line and some optional response header information, and ending with a blank line.

2, starting with 2 (request successful)

This type of status code means that the request has been successfully received, understood, and accepted by the server

3, starting with 3 ( The request was redirected)

This type of status code indicates that the client needs to take further action to complete the request. Usually, these status codes are used for redirection, and the subsequent request address (redirect target) is specified in the Location field of this response.

4, starting with 4: (Request error)

This type of status code means that an error may have occurred on the client, which is hindering the server's processing. Unless the response is a HEAD request, the server SHOULD return an entity explaining the current error condition and whether it is temporary or permanent. These status codes apply to any request method. Browsers should display any entity content contained in such error responses to the user.

5, starting with 5: (server error)

This type of status code represents that an error or abnormal state occurred during the process of processing the request by the server. It may also be that the server realizes that the current Software and hardware resources are unable to complete processing of the request. Unless this is a HEAD request, the server SHOULD include an explanation of the current error status and whether the condition is temporary or permanent. The browser SHOULD display any entities included in the current response to the user.

The above is the detailed content of What is the use of HTTP status codes?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!