Laravel刀片:@endsection VS @stop

问题描述 投票:30回答:3

在Laravel刀片,我们基本可以这样做:

@section('mysection')

@endsection


@section('mysection')

@stop

是什么@stop@endsection之间的区别?

php laravel-4 blade
3个回答
28
投票

@endsection在Laravel 3中使用,它是在Laravel 4弃用

在Laravel 4到结束,你必须使用一个@stop

您可以参考这里的更新日志http://wiki.laravel.io/Changelog_%28Laravel_4%29#Blade_Templating


7
投票

Authoritative answer by Taylor Otwell

@endsection在L4成为@stop,就像@yieldSection成为@show

At github, Taylor Otwell said

@stop只是@endsection从L3 .. @show只是@yieldSection


4
投票

无论@endsection@stop作品。

在Laravel 4似乎只有@stop支持1。但是从Laravel 5日起@stop甚至没有提到在文档2

所以我建议使用@endsection

看到:

© www.soinside.com 2019 - 2024. All rights reserved.