Laravel

Blade Templates

Blade syntax, directives, layouts, components, slots, includes, conditional rendering, loops

18 면접 질문·
Junior
1

Which Blade syntax displays a variable while automatically escaping HTML characters to prevent XSS vulnerabilities?

답변

The syntax {{ $variable }} automatically escapes HTML characters using htmlspecialchars, protecting against XSS attacks. Always use {{ }} by default to display user data, unless you explicitly need to display unescaped HTML with {!! !!}.

2

What is the main difference between {{ $html }} and {!! $html !!}?

답변

{{ $html }} automatically escapes HTML characters to prevent XSS injections, while {!! $html !!} displays raw content without escaping. Use {!! !!} only to display trusted HTML, such as internally generated or validated content. Never display user data with {!! !!}.

3

How to inherit from a parent layout in a child Blade template?

답변

The @extends('layouts.app') directive allows a child template to inherit from a parent layout. It must be the first line of the Blade file. Then use @section to define content for sections declared with @yield in the parent layout.

4

Which Blade directive defines a placeholder in a parent layout that will be filled by child templates?

5

How to include a partial Blade file in a template?

+15 면접 질문

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

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

무료로 시작하기