본문으로 바로가기

사용 법

use Symfony\Component\HttpFoundation\Response;

abort(Response::HTTP_FORBIDDEN, 'Access denied');

 

또는 

abort(404, 'Not Found');

 

또는 

abort(\Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN, 'Access denied');

 

결과화면

 

 

 

 

상수명 값 의미

상수명 의미
Response::HTTP_CONTINUE 100 Continue
Response::HTTP_SWITCHING_PROTOCOLS 101 Switching Protocols
Response::HTTP_OK 200 OK
Response::HTTP_CREATED 201 Created
Response::HTTP_ACCEPTED 202 Accepted
Response::HTTP_NON_AUTHORITATIVE_INFORMATION 203 Non-Authoritative Information
Response::HTTP_NO_CONTENT 204 No Content
Response::HTTP_RESET_CONTENT 205 Reset Content
Response::HTTP_PARTIAL_CONTENT 206 Partial Content
Response::HTTP_MULTIPLE_CHOICES 300 Multiple Choices
Response::HTTP_MOVED_PERMANENTLY 301 Moved Permanently
Response::HTTP_FOUND 302 Found
Response::HTTP_SEE_OTHER 303 See Other
Response::HTTP_NOT_MODIFIED 304 Not Modified
Response::HTTP_USE_PROXY 305 Use Proxy
Response::HTTP_TEMPORARY_REDIRECT 307 Temporary Redirect
Response::HTTP_BAD_REQUEST 400 Bad Request
Response::HTTP_UNAUTHORIZED 401 Unauthorized
Response::HTTP_PAYMENT_REQUIRED 402 Payment Required
Response::HTTP_FORBIDDEN 403 Forbidden
Response::HTTP_NOT_FOUND 404 Not Found
Response::HTTP_METHOD_NOT_ALLOWED 405 Method Not Allowed
Response::HTTP_NOT_ACCEPTABLE 406 Not Acceptable
Response::HTTP_PROXY_AUTHENTICATION_REQUIRED 407 Proxy Authentication Required
Response::HTTP_REQUEST_TIMEOUT 408 Request Timeout
Response::HTTP_CONFLICT 409 Conflict
Response::HTTP_GONE 410 Gone
Response::HTTP_LENGTH_REQUIRED 411 Length Required
Response::HTTP_PRECONDITION_FAILED 412 Precondition Failed
Response::HTTP_REQUEST_ENTITY_TOO_LARGE 413 Payload Too Large
Response::HTTP_REQUEST_URI_TOO_LONG 414 URI Too Long
Response::HTTP_UNSUPPORTED_MEDIA_TYPE 415 Unsupported Media Type
Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE 416 Requested Range Not Satisfiable
Response::HTTP_EXPECTATION_FAILED 417 Expectation Failed
Response::HTTP_INTERNAL_SERVER_ERROR 500 Internal Server Error
Response::HTTP_NOT_IMPLEMENTED 501 Not Implemented
Response::HTTP_BAD_GATEWAY 502 Bad Gateway
Response::HTTP_SERVICE_UNAVAILABLE 503 Service Unavailable
Response::HTTP_GATEWAY_TIMEOUT 504 Gateway Timeout
Response::HTTP_HTTP_VERSION_NOT_SUPPORTED 505 HTTP Version Not Supported

 

 

또는 아래처럼 그냥 호출

return response('Bad Request', 400);