简体   繁体   English

在所有页面上,动态@yield均不显示任何内容。 如何在所有页面之间共享数据?

[英]On all pages dynamic @yield does not show anything. How do I share data between all pages?

On all internal pages, except for the layouts/app.blade.php , these blocks are empty. 在所有内部页面上,除了layouts / app.blade.php之外 ,这些块都是空的。 Why? 为什么?

<li>
    @yield('fresh_comments')
    @yield('news_month')
    @yield('news_random')
</li>

It seems like your app.blade.php does not contain 看来您的app.blade.php不包含

   @section('fresh_comments')
   @end

Can you ether paste your complete 'app.blade.php' or the fragment where you include '@section('fresh_comments')'? 您是否可以粘贴完整的'app.blade.php'或包含'@section('fresh_comments')'的片段?

Edit : 编辑:

@extends('layouts/app.blade.php')

should be 应该

@extends('layouts.app')

您无需在扩展中使用blade.php名称,而只需使用路径和点语法中的名称即可,如下所示:

@extends('layouts.app')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM