blade의 @endsection 과 @stop 의 차이점

Submitted by river - 등록 8 years ago - 수정 8 years ago
@section('content')

@stop

blade의 섹션을 닫을 때, Laravel 3에서는 @endsection, Laravel 4에서는 @stop으로 바뀐 걸로 알고 있었는데, Laravel 5 예제 소스들에서 @endsection이 보여서 둘 간의 차이점을 찾아봤다.

Illuminate\View\Compilers\BladeCompiler

    /**
     * Compile the end-section statements into valid PHP.
     *
     * @param  string  $expression
     * @return string
     */
    protected function compileEndsection($expression)
    {
        return '<?php $__env->stopSection(); ?>';
    }

    /**
     * Compile the stop statements into valid PHP.
     *
     * @param  string  $expression
     * @return string
     */
    protected function compileStop($expression)
    {
        return '<?php $__env->stopSection(); ?>';
    }

두개가 같은 기능이다.

comments powered by Disqus