Php 叶片落叶层-产量和含量
经过一些无用的研究,我不得不问这个问题。 我用的是拉威尔5.6 我的控制器在我的位置Php 叶片落叶层-产量和含量,php,laravel,laravel-5.6,Php,Laravel,Laravel 5.6,经过一些无用的研究,我不得不问这个问题。 我用的是拉威尔5.6 我的控制器在我的位置 public function index() { return view('layout.app'); } 其中app.blade.php看起来像: <html> <head> <title>App Name - @yield('title')</title> </head> <body> @section('sideb
public function index()
{
return view('layout.app');
}
其中app.blade.php看起来像:
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class="container">
@yield('content')
</div>
</body>
</html>
应用程序名称-@yield('title'))
@节(“侧栏”)
这是主侧边栏。
@展示
@产量(‘含量’)
而child.blade.php是:
@extends('app')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<p>This is my body content.</p>
@endsection
@extends('app')
@节(“标题”、“页面标题”)
@节(“侧栏”)
@母公司
这将附加到主侧边栏
@端部
@节(“内容”)
这是我的身体内容
@端部
这个文件看起来像是laravel教程,我试过使用自己的文件,但仍然得到相同的错误,所以为了简化,我使用了laravel的文件
问题是我从来没有见过child.blade.php
有什么常见的错误吗?我被卡在哪里了
我以前做过,做得很好,我很快构建了应用程序,但现在我找不到解决方案。您需要在控制器上调用子视图
public function index()
{
return view('child');
}
因此控制器将调用子视图,子视图将调用应用视图,因为您在子视图的开头扩展应用视图您需要使用
返回视图(“子视图”)代码>而不是返回视图('layout.app')代码>
public function index()
{
return view('child');
}