laravel 未找到查看主布局

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27954644/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 10:42:05  来源:igfitidea点击:

View master layout not found

phphtml.htaccesslaravelview

提问by user3107806

I'm new in laravel. However, I'm created blade templates and integrate with my offline index webpage. It consists of signin.html and signout.html. So below is the structure way of managing my files:

我是 Laravel 的新手。但是,我创建了刀片模板并与我的离线索引网页集成。它由 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

首页.blade.php

@extends('layouts.master');

Master.blade.php

大师之刃.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>

The following two files will output the signin form in the page. I have no idea how they get into it. I didn't include anything. My public folder :

以下两个文件将在页面中输出登录表单。我不知道他们是如何进入的。我没有包括任何东西。我的公共文件夹:

--assets
---css
---fonts
---images
---js
--index.php
--.htacess

Index.php

索引.php

require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
$app->run();
$app->shutdown();

.htaccess

.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

路线

Route::get('/', array (
 'as' => 'home',
 'uses' => 'HomeController@home'
));

Home Controller

家庭控制器

public function home() {
    return View::make('home');
}

Now if I'm open-up my localhost, View [includes.master] not found. Perhaps my storage folder still contains the template codes, but I tried to delete, it keep generate a new one.

现在,如果我打开我的本地主机,View [includes.master] not found。也许我的存储文件夹中仍然包含模板代码,但我尝试删除,它不断生成一个新的。

Another problem is when I adding @extends('includes.master') into signin.blade.php or singup.blade.php at the top. The localhost and localhost/account/signin or localhost/account/register will be Internal Server Error: 500.

另一个问题是当我将 @extends('includes.master') 添加到顶部的 signin.blade.php 或 singup.blade.php 时。localhost 和 localhost/account/signin 或 localhost/account/register 将是Internal Server Error: 500

回答by MD. Atiqur Rahman

Well, Let me tell you something. What's the need to include your header from an external folder? Please follow this, your master layout should be like this:

好吧,让我告诉你一些事情。从外部文件夹中包含标题有什么需要?请按照这个,你的主布局应该是这样的:

<!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.phpshould be like this:

home.blade.php应该是这样的:

@extends(layouts.master) 
@section('content')
 <p> Hello, this works </p>
@stop

Now let me if you need any further help.

现在,如果您需要任何进一步的帮助,请告诉我。

回答by PawelW

Check viewsfolder permissions. In my case there was a problem.

检查views文件夹权限。就我而言,出现了问题。

For this folder and all the files inside permissionsshould be 755.

对于这个文件夹,里面的所有文件的权限应该是755

回答by Patrick Hellebrand

Had the same issue, think that has something to do with blades caching of the view dir. I fixed it by changing the @extends(example.master) to another template and then back to wanted path. Worked without doing anything else, but as always first try php artisan view:clear.

有同样的问题,认为这与视图目录的刀片缓存有关。我通过将 @extends(example.master) 更改为另一个模板然后返回到想要的 path 来修复它。没有做任何其他事情就工作了,但一如既往地先尝试php artisan view:clear

Greets, Pat

问候,帕特