laravel 区块继承

看到我的文章感觉有用的话,在评论区下面扣1,能够让我感受到你们的存在,也给我动力继续写的更好,谢谢

 继承

模板声明: @yield('要定义的区块名')

-----------------------------------------------------------------------------------

 模板调用

@extends('layouts.admin')

@继承('文件夹.文件名')

相当于TP框架下的 extend name="路径/名字"

 

@section('title')      -> (模板声明: @yield('要定义的区块名'))

@endsection        

@区块('区块名')

相当于TP框架下的 block name="区块名"

<html>
    <head>
        <title>应用程序名称 - @yield('title')</title>
    </head>
    <body>
        @section('sidebar')
            这是主布局的侧边栏。
        @show

        <div class="container">
            @yield('content')
        </div>
    </body>
</html>

  

@extends('layouts.app')
 
@section('title', 'Page Title')
 
@section('sidebar')
     
 
    <p>这将追加到主布局的侧边栏。</p>
@endsection
 
@section('content')
    <p>这是主体内容。</p>
@endsection

  

猜你喜欢

转载自www.cnblogs.com/chenliuxiao/p/9255336.html