【问题标题】:Laravel Blade doesn't include partialLaravel Blade 不包含部分
【发布时间】:2014-08-08 11:37:59
【问题描述】:

我正在尝试向我的布局添加一个头文件,如下所示:

视图/布局/main_layout.blade.php

@include('layouts.header.stylesheets')

该文件的内容是:

@section('stylesheets')
    {{ stylesheet_link_tag('style.css') }}
@stop

但这不包括任何东西,你能告诉我我做错了什么吗?

【问题讨论】:

    标签: php html laravel include blade


    【解决方案1】:

    如果你包含一个文件,你只需这样做:

    视图/布局/main_layout.blade.php

    @include('layouts.header.stylesheets')
    

    然后在你的另一个文件中:

    {{ stylesheet_link_tag('style.css') }}
    

    如果你是 @yielding 到那个文件,你只能使用 @section

    【讨论】:

      猜你喜欢
      • 2019-11-25
      • 1970-01-01
      • 2017-06-21
      • 2013-06-18
      • 2015-01-30
      • 2017-01-07
      • 2017-12-12
      • 2023-04-07
      • 2017-03-26
      相关资源
      最近更新 更多