我得到这个错误:
视图布局。主人]没有找到。(观点:C: xampp5 根 laravel laravel views page.blade.php资源)
这是我的master.blade.php:
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@show
<div class = "container">
@yield('content')
</div>
</body>
</html>
@extends('layouts.master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection
下面是route的相关部分:
Route::get('blade', function () {
return view('page',array('name' => 'Random Name'));
});
将master.blade.php
放入此目录:
C:xampp5htdocslaravellaravelresourcesviewslayouts
或更改布局路径:
@extends('layouts.master')
:
@extends('master')
这样做
@extends('master')
@section('title', 'Page Title')
@section('sidebar')
@parent
<p>This is appended to the master sidebar.</p>
@endsection
@section('content')
<h2>{{$name}}</h2>
<p>This is my body content.</p>
@endsection