Not to mention directly recording the code, some students may need it to save time
<?php
declare(strict_types=1);
namespace App\Constants;
use Hyperf\Constants\AbstractConstants;
use Hyperf\Constants\Annotation\Constants;
/**
* @Constants
*/
class HttpCode extends AbstractConstants
{
/**
* @Message("OK")
*Respond to a successful get, put, patch, or delete operation. It can also be used for post operations that do not create new resources
*/
const OK = 200;
/**
* @Message("Created")
*Respond to a post operation that creates a new resource. It should have a location header pointing to the new resource address
*/
const CREATED = 201;
/**
* @Message("Accepted")
*The server has accepted the request but has not yet processed it. The response should contain corresponding instructions to tell the client where to query the information about the request
*/
const ACCEPTED = 202;
/**
* @Message("No Content")
*Respond to successful requests that do not return a response body (such as delete requests)
*/
const NO_CONTENT = 203;
/**
* @Message("Moved Permanently")
*The requested resource has been permanently moved to a new location
*/
const MOVED_PERMANENTLY = 301;
/**
* @Message("Found")
*The requested resource now temporarily responds to the request from a different URI
*/
const FOUNT = 302;
/**
* @Message("See Other")
*The response corresponding to the current request can be found on another URI, and the client should use the get method to make the request. For example, when creating a resource that has been created, you can return 303
*/
const SEE_OTHER = 303;
/**
* @Message("Not Modified")
*Used when the HTTP cache header takes effect
*/
const NOT_MODIFIED = 304;
/**
* @Message("Temporary Redirect")
*The response corresponding to the current request can be found on another URI. The client should keep the original request method to make the request
*/
const TEMPORARY_REDIRECT = 307;
/**
* @Message("Bad Request")
*Request exception, for example, the body in the request cannot be resolved
*/
const BAD_REQUEST = 400;
/**
* @Message("Unauthorized")
*No authentication or illegal authentication
*/
const UNAUTHORIZED = 401;
/**
* @Message("Forbidden")
*The server understood the request but refused to execute it
*/
const FORBIDDEN = 403;
/**
* @Message("Not Found")
*Request a resource that does not exist
*/
const NOT_FOUND = 404;
/**
* @Message("Method Not Allowed")
*The requested HTTP method does not allow access by the current authenticated user
*/
const METHOD_NOT_ALLOWED = 405;
/**
* @Message("Gone")
*Indicates that the currently requested resource is no longer available. This is useful when calling older versions of the API
*/
const GONE = 410;
/**
* @Message("Unsupported Media Type")
*If the content type in the request is wrong
*/
const UNSUPPORTED_MEDIA_TYPE = 415;
/**
* @Message("Unprocessable Entity")
*Used to indicate a verification error
*/
const UNPROCESSABLE_ENTITY = 422;
/**
* @Message("Too Many Requests")
*Access was denied because the request frequency reached the maximum
*/
const TOO_MANY_REQUESTS = 429;
/**
* @Message("Internal Server Error")
*The server encountered an unexpected condition that prevented it from processing the request
*/
const SERVER_ERROR = 500;
/**
* @Message("Not Implemented")
*The server does not support a feature required by the current request
*/
const NOT_IMPLEMENTED = 501;
/**
* @Message("Bad Gateway")
*When a server working as a gateway or proxy tries to execute a request, it receives an invalid response from the upstream server
*/
const BAD_GATEWAY = 502;
/**
* @Message("Service Unavailable")
*The server is currently unable to process requests due to temporary server maintenance or overload. This situation is temporary and will recover in a period of time. If the delay time can be estimated, the response can include a retry after
*The header is used to indicate the delay time (the content can be a number, in seconds; or a time format specified by the HTTP protocol). If this retry after information is not given, the client should process it in the manner of processing the 500 response
*/
const SERVICE_UNAVAILABLE = 503;
/**
* @Message("Gateway Timeout")
*/
const GATEWAY_TIMEOUT = 504;
/**
* @Message("HTTP Version Not Supported")
*/
const HTTP_VERSION_NOT_SUPPORTED = 505;
/**
* @Message("Variant Also Negotiates")
*/
const VARIANT_ALSO_NEGOTIATES = 506;
/**
* @Message("Insufficient Storage")
*/
const INSUFFICIENT_STORAGE = 507;
/**
* @Message("Loop Detected")
*/
const LOOP_DETECTED = 508;
/**
* @Message("Not Extended")
*/
const NOT_EXTENDED = 510;
/**
* @Message("Network Authentication Required")
*/
const NETWORK_AUTHENTICATION_REQUIRED = 511;
/**
* @Message("Network Connect Timeout Error")
*/
const NETWORK_CONNECT_TIMEOUT_ERROR = 599;
}
This work adoptsCC agreement, reprint must indicate the author and the link to this article