Laravel 4 刀片能否屈服于同一文件中的某个部分?

Laravel 4 刀片能否屈服于同一文件中的某个部分?,laravel-4,templating,blade,Laravel 4,Templating,Blade,我有master.blade.php文件,其中包含@yield('mainsecute')。然后我有另一个文件,带有: @extends('layouts.master') @section('mainection') test1 @yield('othersection') @stop @section('othersection') test2 @stop 我可以看到test1,但看不到test2——从中我得出结论,blade不允许您屈服于同一文件中定义的部分。

我有master.blade.php文件,其中包含
@yield('mainsecute')
。然后我有另一个文件,带有:

@extends('layouts.master')

@section('mainection')
    test1
    @yield('othersection')
@stop

@section('othersection')
    test2
@stop

我可以看到
test1
,但看不到
test2
——从中我得出结论,blade不允许您屈服于同一文件中定义的部分。有办法解决这个问题吗?或者我必须在这两个文件之间添加第三个文件,以包含main部分和yield到othersection吗?

可以显示它,但是@section必须在@yield之前写入

@extends('layouts.master')

@section('othersection')
  test2
@stop

@section('mainection')
  test1
  @yield('othersection')
@stop