为什么我的Blade模板内容显示了两次


Why is my Blade template content displayed twice?

我的刀片模板有问题。出于某种原因,我将视图的内容打印出两次,一次是由yield打印出来的,另一次是在扩展的视图执行任何操作之前。

我的路线是:

Route::get('/', array('as' => 'home', function () {
    return View::make('default');
}));

默认视图(default.blade.php)为:

@extends('test')
@section('title')
    Default
@show
@section('content')
    <p>Content goes here<p>
@show

测试视图(test.blade.php)是这样的:

<h1>Anything above should be be there!</h1>
<h3>@yield('title')</h3>
@yield('content')

这就产生了:

Default
<p>Content goes here<p>
<h1>Anything above should be be there!</h1>
<h3>Default</h3>
<p>Content goes here<p>

尝试

@extends('test')
@section('title')
    Default
@stop
@section('content')
    <p>Content goes here<p>
@stop

这不应该是…@stop而不是@show

@extends('test')
@section('title')
Default
@stop
@section('content')
<p>Content goes here<p>
@stop