Laravel 在views中加载公共页面的实现代码
时间:2021-01-12 13:20:50|栏目:PHP代码|点击: 次
1:我们使用了Blade模板,并创建一个layout作为通用的模板。将子页面作为yield输出:
<!-- store in resource/view/layout.blade.php -->
<!DOCTYPE html>
<html>
<head>
<title>Laravel 5 - @yield('title')</title>
<link rel="stylesheet" href="./style/page.css" rel="external nofollow" >
<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
上一篇:PHP整合PayPal支付
栏 目:PHP代码
下一篇:PHP设计模式之观察者模式(Observer)详细介绍和代码实例
本文标题:Laravel 在views中加载公共页面的实现代码
本文地址:http://www.codeinn.net/misctech/44358.html






