Laravel布局不起作用

Rematnarab

我正在尝试一些非常简单且无法正常工作的东西。我有2页。admin.blade.php和left.blade.php我正在尝试使用管理页面作为母版页面。并包括left.blade.php中的日期

管理页面仅打印“ test”作为结果,而left.admin.php中不包含任何内容。我看不出有什么问题。提前致谢

文件结构

-- resources
   --views
     *admin.blade.php
     *left.blade.php

left.blade.php

@extends('admin')

@section('content')
   baran
@stop

admin.blade.php

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
    <title> @yield('title')</title>
</head>
<body>
    <?php
    // put your code here
    ?>

    @yield('content')

    test
<div id='footer'>
    @yield('footer')
</div>
</body>
</html>

在web.php route命令是

Route::get('/admin', function () {
    return view('admin');
});
阿列克谢·梅曾宁(Alexey Mezenin)

如果你想包括日期left.blade.php,你应该使用@include()的指令admin.blade.php

@include('left')

如果你的主要内容是left.blade.php,你正在使用admin.blade.php的布局才改变你的路线:

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章