在Laravel Blade中,我们基本上可以这样做:
@section('mysection')
@endsection
@section('mysection')
@stop
@stop
和 @endsection
有什么区别?
@section('mysection')
@endsection
@section('mysection')
@stop
@stop
和 @endsection
有什么区别?
@endsection
在 Laravel 3 中使用,但在 Laravel 4 中已被弃用。
在 Laravel 4 中结束一个 section,你需要使用 @stop
。
你可以参考这里的 Changelog: http://wiki.laravel.io/Changelog_%28Laravel_4%29#Blade_Templating
在L4中,@endsection
变成了@stop
,就像@yieldSection
变成了@show
一样。
@stop只是L3中的@endsection.. @show只是
@yieldSection
@endsection
和@stop
。我觉得@endsection
更加直观,所以在 Laravel 8 中我也使用了@endsection
。请注意:在 Laravel 8 文档中,你不会找到更多关于@stop
的内容。 - Maik Lowrey