Laravel 静态资源管理

<link rel="stylesheet" href="{{ asset('bootstrap/css/bootstrap.min.css') }}" />
asset()对应的路径是Public目录下。

方式一:yield()方法在父模板中的使用
父模板:
@yield('content')

子模板:
@section('content')
这里是具体内容
@stop


方法二:section()方法在父模板中的使用
父模板:
@section('content')
父模板中的内容
@show

子模板:
@section('content')
这里是具体内容
@stop
结论:section() 方法可以在父模板中预定义内容。如果子模板也定义内容,则都显示。

子模板中使用父级布局需要继承父级模板,使用extends方法,示例:@extends('common/layouts')

子模板中需要引用其他页面时,使用include方法,示例:@include('common.message')





猜你喜欢

转载自www.cnblogs.com/gyfluck/p/9067746.html