【问题标题】:Laravel - View [layouts.master] not found [duplicate]Laravel - 查看 [layouts.master] 未找到 [重复]
【发布时间】:2019-09-11 02:13:15
【问题描述】:

我正在逐步制作 Laravel 教程,但 @extends 让我出错,即找不到 View [layouts.master]。我的 layouts 文件夹位于 resources/views/layouts 中,而我的 master.blade.php 位于 layouts 文件夹中。我的 connexion.blade.php 在 resources/views/connexion.blade.php 中,所以使用 @extends('layouts.master') 我不应该有任何错误。我已经完美地完成了 laravel 教程,但它似乎很奇怪。

资源/视图/CONNEXION.BLADE.PHP

@extends('layouts.master')

@section('titre', 'Connexion')

@section('body')

@stop

资源/视图/布局/MASTER.BLADE.PHP

<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8">
    <title>Site Panel - @yield('titre')</title>
  </head>
  <body>
    @yield('body')
  </body>
</html>

【问题讨论】:

    标签: php laravel layout laravel-blade templating


    【解决方案1】:

    问题不是未找到,而是文件权限,为什么 laravel dev 没有拒绝权限而不是未找到

    【讨论】:

      【解决方案2】:

      等等……My layouts folder is in resources/views/layouts and my master.blade.php in the layouts folder.

      也就是说你的master.blade.phpresources/views/layouts/layouts 里面?这意味着扩展函数将是@extend('layouts.layouts.master')

      【讨论】:

        【解决方案3】:
        Blade Templates
        Layout
        // Extend your theme layout
        @extends('layouts.master')
        // Start section
        @section('title')
        // End Section
        @endsection
        @parent
        // Show section in your theme
        @yield('name')
        // Include view in your file
        @include('view.name')
        // Include view with pass data
        @include('view.name', ['key' => 'value']);
        

        【讨论】:

          猜你喜欢
          • 2017-07-17
          • 2014-06-02
          • 2019-06-23
          • 1970-01-01
          • 2020-01-02
          • 2018-03-09
          • 2015-11-28
          • 1970-01-01
          • 2017-05-30
          相关资源
          最近更新 更多