2015-12-25 27 views
0

我想显示具有以下代码视图:PHPLaravel:我如何显示搜索

{!! Stored in /resources/views/about.blade.php !!} 
@extends('layouts.app') 
@section('title') 
Conway's Game Of Life - About 
@endsection 

@section('content') 
<h2>Conway's Game Of Life - About</h2> 

<p>The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.</p> 
@endsection 

然后将下面的主刀页:
<!-- Stored in /resources/views/layouts/app.blade.php --> <title>@yield('title')</title>
@yield('content')

在这之后的路线。 PHP有:

Route::get('/', function() { 
    return view('index'); 
}); 

Route::get('/about/', function() { 
    return view('about'); 
}); 

Route::get('/about/', '[email protected]'); 

我收到以下错误:

`FileViewFinder.php中的InvalidArgumentException行137:

View [index.blade] not found。 FileViewFinder.php 137行中的ErrorException:

未找到[index.blade]。 (View:C:\ Bitnami \ wampstack-5.5.30-0 \ apache2 \ htdocs \ GameOfLife \ resources \ views \ layouts \ app.blade.php) FileViewFinder.php中的ErrorException 137行:

View [index .blade]找不到。 (查看:C:\ Bitnami \ wampstack-5.5.30-0 \ apache2 \ htdocs \ GameOfLife \ resources \ views \ layouts \ app.blade.php)(查看:C:\ Bitnami \ wampstack-5.5.30-0 \ apache2 \ htdocs \ GameOfLife \ resources \ views \ layouts \ app.blade.php)`

我该做些什么才能避免出错?

感谢您帮助我摆脱困境!

PS,建议:下面
无论答案找到一个解决问题的办法。这可以是我使用PHP7,而不是任何较小的版本?它可能影响Laravel程序代码的执行。

回答

1

你叫视图about.blade.php但你缺少视图称为index.blade.php因为你定义的路线

Route::get('/', function() { 
    return view('index'); 
}); 

此外,由于使用的是布局模板预计,在顶部你必须指定所有你的观点哪个视图你跟@extend延长

所有的

https://laravel.com/docs/5.1/blade#extending-a-layout

+0

它是'@ extends'。 – lagbox

0

杉杉确保layouts文件夹下存在app.blade.php它具有以下两个语句@yield('content')体内和@yield('title')之间head标签。
难道这些不都是

Route::get('about', function() { 
    return view('about'); 
}); 
OR 
Route::get('about', '[email protected]'); 


之一,并确保您的index.blade.phpviews

存在如果仍出现错误,请发表评论。