1:我们使用了Blade模板,并创建一个layout作为通用的模板。将子页面作为yield输出:

<!-- store in resource/view/layout.blade.php -->
<!DOCTYPE html>
<html>
  <head>
    <title>Laravel 5 - @yield('title')</title>

    <link  href="./style/page.css"  >
    <script src="./js/jquery.min.js"></script>
    <script src="./js/bootstrap.min.js"></script>
  </head>
  <body>
    <header>
    </header>

 @yield('content')

 
    <footer>
    </footer>
 
  </body>
</html>

2: 在子页面使用

<!-- store in resource/view/index.blade.php -->
@extends('layout')
 
@section('title', 'test')
 
@section('content')
<style>
  .pageText {
    font-color : #00ff00;
  }
</style>
 
<div>
  Some Child Page
</div>
 
@endsection