사용 법
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);
'[ Web 관련 ] > Laravel 12.5.0' 카테고리의 다른 글
.env 설정 항목들 (2) | 2025.08.14 |
---|---|
라라벨 POST 데이터중 필요한 항목만 선별해서 DB에 저장하는 샘플 (0) | 2024.06.25 |
라라벨 암호화 (0) | 2024.06.24 |
라라벨 엑셀 다운로드 업로드 (0) | 2024.06.15 |
Cannot use object of type stdClass as array 오류 (0) | 2024.05.24 |