Laravel 静态资源管理

mac2022-06-30  22

<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')根据当前页面判断左侧菜单显示样式 <div class="left-group"> <a class="list-group-item {{ Request::getPathInfo()=='/Student/index'?'active':'' }}" href="{{ url('Student/index') }}"> 学生列表 </a> <a class="list-group-item {{ Request::getPathInfo()=='/Student/create'?'active':'' }}" href="{{ url('Student/create') }}"> 新增学生 </a></div>  

转载于:https://www.cnblogs.com/gyfluck/p/9067746.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)