【问题标题】:How can I overcome Laravel 8 template system problem如何克服 Laravel 8 模板系统问题
【发布时间】:2021-01-14 23:09:09
【问题描述】:

在布局文件夹中,我有一个名为 "app.blade.php" 的文件。 为了呈现我在文件中写入的其他 balde 文件中的一些内容 @yield('content')

我在 "views/admin" 名称 "dashboard.blade.php" 中创建了另一个文件。这个文件里写的代码是

@extends('home')
@section('content')
    Test text
@endsection

但内容没有加载到 "app.blade.php" 文件中,因此没有任何内容

@yield('content') section

怎么办?

【问题讨论】:

  • 你可以查看我的答案。让我知道更新。如果您发现答案有帮助,请不要忘记接受我的答案。谢谢。
  • 你能告诉我们你的'layout.app'文件吗?那里发生了什么事

标签: php laravel laravel-8


【解决方案1】:

更新这个

@extends('layouts.app')  <---------- it will extend app.blade.php  then inside that section will render content
@section('content')
    Test text
@endsection

参考链接https://laravel.com/docs/8.x/blade#extending-a-layout

【讨论】:

  • 我写错了。像你一样写作有相同的输出
【解决方案2】:

错误识别并解决

你说 app.blade.php 中没有加载内容,但你已经扩展了主页。

像这样更新你的脚本->

@extends('layouts.app')
@section('content')
Test text
@endsection

我认为你在哪里做错了。让我知道更新

【讨论】:

  • 我写错了。像你一样写作有相同的输出
  • 你会建议这些文件,那么最好了解你遇到的实际问题在哪里?因为这个脚本看起来不错。
猜你喜欢
  • 2010-11-12
  • 2010-12-24
  • 1970-01-01
  • 2012-05-25
  • 1970-01-01
  • 1970-01-01
  • 2021-08-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多