@yield和@section不起作用

时间:2017-06-16 05:55:42

标签: twitter-bootstrap laravel layout laravel-blade

this is the code in the main.blade.php so i place an @yield('content') inside the div tags of my bootstrap template but it's that getting the display that should be on the home.blade.php

<div class="container">
     @yield('content')
</div>

this is the code on my home.blade.php

@extends('main')

@section('content')
<div class="row">
    <h1>this content should show on my main</h1>
</div>
@endsection

I dont know why its not working it seems like the @yield and @section is not working by the I'm using laravel 5.4 and it's not displaying any error then what could be wrong

I dont know why its not working it seems like the @yield and @section is not working by the I'm using laravel 5.4 and it's not displaying any error then what could be wrong

我不知道为什么它不工作似乎@yield和@section不工作我使用laravel 5.4并且它没有显示任何错误然后可能是错误的

1 个答案:

答案 0 :(得分:1)

您不应该在一个文件中使用所有这些指令。例如,在布局文件中使用@yield,然后在由控制器路由呈现的视图中使用@extend。 @section与他们填写的应用布局的相应区域对齐。