未找到查看主布局
View master layout not found
我是 laravel 的新人。但是,我创建了 blade 模板并与我的离线索引网页集成。它由 signin.html 和 signout.html 组成。所以下面是管理我的文件的结构方式:
-views
--account
---signin.blade.php
---signup.blade.php
--includes
---head.blade.php
---footer.blade.php
--layouts
---master.blade.php
--home.blade.php
Home.blade.php
@extends('layouts.master');
Master.blade.php
<!DOCTYPE html>
<html>
<head>
@include('includes.head');
</head>
<body class="bg-info">
<!-- @include('includes.navigation'); -->
<!-- @extends('account.signin'); -->
<!-- @yield('content') -->
<!-- @yield('content') -->
@include('includes.footer');
</body>
</html>
以下两个文件将在页面中输出登录表单。我不知道他们是怎么进去的。我没有包括任何东西。我的 public 文件夹:
--assets
---css
---fonts
---images
---js
--index.php
--.htacess
Index.php
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
$app->run();
$app->shutdown();
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
路线
Route::get('/', array (
'as' => 'home',
'uses' => 'HomeController@home'
));
家庭控制器
public function home() {
return View::make('home');
}
现在,如果我是 open-up 我的本地主机,查看 [[=63=]] 未找到 。可能我的storage文件夹里还有模板代码,但是我试着删除了,一直生成新的。
另一个问题是当我将@extends('includes.master') 添加到顶部的signin.blade.php 或singup.blade.php 时。
localhost 和 localhost/account/signin 或 localhost/account/register 将是 Internal Server Error: 500 .
好吧,让我告诉你一件事。需要从外部文件夹中包含您的 header 吗?请按照这个,你的主布局应该是这样的:
<!DOCTYPE html>
<html>
<head>
//put your codes here , not the include function
</head>
<body class="bg-info">
@include('includes.navigation');
@extends('account.signin');
@yield('content')
@include('includes.footer');
</body>
</html>
home.blade.php
应该是这样的:
@extends(layouts.master)
@section('content')
<p> Hello, this works </p>
@stop
如果您需要任何进一步的帮助,请联系我。
检查 views
文件夹权限。在我的情况下有问题。
对于这个文件夹和里面的所有文件,权限应该是755。
有同样的问题,认为与视图目录的刀片缓存有关。我通过 将 @extends(example.master) 更改为另一个模板然后返回到想要的路径 来修复它。没有做任何其他事情就工作了,但一如既往地先尝试 php artisan view:clear
.
你好,帕特
我是 laravel 的新人。但是,我创建了 blade 模板并与我的离线索引网页集成。它由 signin.html 和 signout.html 组成。所以下面是管理我的文件的结构方式:
-views
--account
---signin.blade.php
---signup.blade.php
--includes
---head.blade.php
---footer.blade.php
--layouts
---master.blade.php
--home.blade.php
Home.blade.php
@extends('layouts.master');
Master.blade.php
<!DOCTYPE html>
<html>
<head>
@include('includes.head');
</head>
<body class="bg-info">
<!-- @include('includes.navigation'); -->
<!-- @extends('account.signin'); -->
<!-- @yield('content') -->
<!-- @yield('content') -->
@include('includes.footer');
</body>
</html>
以下两个文件将在页面中输出登录表单。我不知道他们是怎么进去的。我没有包括任何东西。我的 public 文件夹:
--assets
---css
---fonts
---images
---js
--index.php
--.htacess
Index.php
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
$app->run();
$app->shutdown();
.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
路线
Route::get('/', array (
'as' => 'home',
'uses' => 'HomeController@home'
));
家庭控制器
public function home() {
return View::make('home');
}
现在,如果我是 open-up 我的本地主机,查看 [[=63=]] 未找到 。可能我的storage文件夹里还有模板代码,但是我试着删除了,一直生成新的。
另一个问题是当我将@extends('includes.master') 添加到顶部的signin.blade.php 或singup.blade.php 时。 localhost 和 localhost/account/signin 或 localhost/account/register 将是 Internal Server Error: 500 .
好吧,让我告诉你一件事。需要从外部文件夹中包含您的 header 吗?请按照这个,你的主布局应该是这样的:
<!DOCTYPE html>
<html>
<head>
//put your codes here , not the include function
</head>
<body class="bg-info">
@include('includes.navigation');
@extends('account.signin');
@yield('content')
@include('includes.footer');
</body>
</html>
home.blade.php
应该是这样的:
@extends(layouts.master)
@section('content')
<p> Hello, this works </p>
@stop
如果您需要任何进一步的帮助,请联系我。
检查 views
文件夹权限。在我的情况下有问题。
对于这个文件夹和里面的所有文件,权限应该是755。
有同样的问题,认为与视图目录的刀片缓存有关。我通过 将 @extends(example.master) 更改为另一个模板然后返回到想要的路径 来修复它。没有做任何其他事情就工作了,但一如既往地先尝试 php artisan view:clear
.
你好,帕特