我按照laravel的官方文档使用刀片创建模板。我正在尝试制作我的第一个模板但不起作用。
1)存储在resources/views/default.blade.php --->
<html>
<head>
@include('includes.head')
</head>
<body>
<div class="container">
@include('includes.header')
<div id="main" class="row">
@yield('content')
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
2)存储在resources/views/home.blade.php -->
@extends('layouts.default')
@section('content')
I am the Home Page!
@endsection
Run Code Online (Sandbox Code Playgroud)
3)存储在boostrap/app.php -->
$app->get('/', function (){
return view('home');
});
Run Code Online (Sandbox Code Playgroud)
4) localhost:8000/ 返回这个错误 -->
哎呀,看起来出事了。FileViewFinder.php 第 137 行中的 2/2 ErrorException:未找到视图 [layouts.default]。(查看:/home/vagrant/lumen/resources/views/home.blade.php)
in FileViewFinder.php line 137
at CompilerEngine->handleViewException(object(InvalidArgumentException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('/home/vagrant/lumen/storage/framework/views/96985f6d91158d600b1d1b64b5a3060d84415fda.php', array('__env' => object(Factory), 'app' => object(Application))) in CompilerEngine.php line 59
at CompilerEngine->get('/home/vagrant/lumen/resources/views/home.blade.php', array('__env' => object(Factory), …Run Code Online (Sandbox Code Playgroud)