Print variables or default values, this syntax automatically escapes HTML tags in variable content, making HTML tags output as they are
Welcome, {{ $name or 'California' }}
Print the original contents of the variable without escaping the usage
{!! 'My list ' !!}
Cycle
Normal cycle
@foreach ($lists as $list)
{{ $list }}
@endforeach
case where the processing variable is empty
@forelse ($lists as $list)
- {{ $list }}
@empty
- You don't have any lists saved.
@endforelse
If judgment
@if (count($lists) > 1)
@elseif ()
@else
@endif
Create placeholders for content in templates using the following syntax
@yield('content')
Use the following syntax in the view using the template
@extends('layouts.master')
Populate placeholder content with the following syntax
@section('content')
content
@endsection
Use the following syntax to refer to a child php file
@include('partial')
@include('partials.row', ['link' => $link]), passing parameters to the child file
How to decide whether to use some common content in a child view
@section (' advertisement ')
parent content
@show The advertisement section defined by
above does not appear directly in the child view, @show equivalent to @endsection @yield (' advertisement ')
@ Section (' advertisement ')
@parent
child content
@endsection
The content defined in advertisement in the template is displayed in the child view only if @parent is used here
10. Syntax for referencing css,js in templates
{!! Html::style (' Css/app.min.css ')!}
{!! Html::script (' Javascript/jquery-1.10.1.min.js ')!}
{!! Html::script (' Javascript/bootstrap.min.js ')!}
{!! Html::image (' images/logo.png ', ' Todoparrot logo ')!}
Note here that if you write a standard HTML tag, you need to precede a '/' symbol in the path
To use the syntax above to install the HTML package
11. Install HTML Package
Composer require illuminate/html
Configure provider and alias
illuminate\html\ in config/app.php Htmlserviceprovider::class provider Configuration
' Form ' = Illuminate\html\formfacade::class, Facade Configuration
The above describes the blade template engine-the common syntax format, including the blade aspects of the content, I hope that the PHP tutorial interested in a friend helpful.