首页 > 解决方案 > 如何为laravel中的所有页面带来相同的布局

问题描述

我想问一下如何在 laravel 中使所有页面都具有相同的布局。我尝试按照谷歌的一些教程来做到这一点。它带来布局,但在标题顶部显示内容,如果我添加@endsection它隐藏内容。我希望任何人都可以帮助我解决问题。

下面我附上代码。

布局

<html>
<head></head>
<body> 
    @include('admin.header.header')
    @include('admin.sidebar.sidebar')
  <section id="container" class=""> 
   @yield('content')
  </section>
</body>
</body>

内容页面(会员)

@extends('admin.layout')
@section('content')
    i am the home page
@endsection

路线

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

标签: phplaravel

解决方案


使用@stop 代替@endsection

@extends('admin.layout')
@section('content')
i am the home page
@stop

推荐阅读