今天小编就为大家分享一篇Laravel 在views中加载公共页面的实现代码,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧来源gao*daima.com搞@代#码网
1:我们使用了Blade模板,并创建一个layout作为通用的模板。将子页面作为yield输出:
<!-- store in resource/view/layout.blade.php --> <title>Laravel 5 - @yield('title')</title> <header> </header> @yield('content') <footer> </footer>
2: 在子页面使用
<!-- store in resource/view/index.blade.php --> @extends('layout') @section('title', 'test') @section('content') .pageText { font-color : #00ff00; } <div> Some Child Page </div> @endsection
以上就是Laravel 在views中加载公共页面的实现代码的详细内容,更多请关注gaodaima搞代码网其它相关文章!