Laravel

Request & Response

Request object, input handling, file uploads, response types, redirects, JSON responses, cookies, sessions

20 면접 질문·
Junior
1

Which method of the Request object allows retrieving the value of a form field?

답변

The input() method of the Request object allows retrieving data sent via GET, POST, or any other HTTP method. It accepts a field name as a parameter and returns its value, or null if the field does not exist. A default value can be passed as a second parameter to avoid null values.

2

Which method allows checking if a specific field is present in the request?

답변

The has() method checks if one or more fields are present in the request and contain a non-empty value. It returns a boolean. To simply check for field presence even if empty, use filled() which checks the field exists AND is not empty, or exists() to only check presence without validating the value.

3

Which method allows retrieving all request fields as an array?

답변

The all() method returns all request data as an associative array. Unlike only() which filters specific fields, or except() which excludes certain fields, all() returns all submitted data. This method is useful for passing all data to validation or for global processing.

4

How to retrieve only specific fields from a request?

5

How to retrieve an uploaded file from an HTTP request?

+17 면접 질문

다음 면접을 위해 Laravel을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기