Print variables or default values. This syntax will automatically escape the html tags in the variable content, causing the html tags to be output as they are. Welcome, {{ $name or 'California' }}
Print the original content of the variable , usage without escaping{!! 'My list <script>alert("spam spam spam!")</script>' !!}
Loop
Normal loop@foreach ($lists as $list)
<li>{{ $list }}</li>
@endforeach
Handle the case when the variable is empty@forelse ($lists as $list)
<li>{{ $list }}</li>
@empty
<li>You don't have any lists saved.
if judgment
@elseif ()@else
@endif
Use the following syntax in the template to create content Placeholder
Use the template in the view using the following syntax
Use the following syntax to populate the placeholder content
content@endsection
Use the following syntax to reference sub-php files
@include('partials.row', ['link' => $link])
, pass parameters to sub-filesHow to decide whether to use some public content in sub-views
parent content @show
The advertising section defined by the above syntax will not be displayed directly in the subview. @show is equivalent to @endsection @yield('advertisement')
@section('advertisement')
@parent child content
@endsection
Only if @parent is used here, the content defined in the advertisement in the template will be displayed in the subview
10. Syntax for referencing css, js, etc. in the template{!! 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') !!}
here It should be noted that if you write a standard html tag, you need to add a '/' symbol in front of the path
To use the above syntax, you need to install the HTML package
11. Install the HTML packagecomposer require illuminate/html
Configure provider and alias in config/app.php
IlluminateHtmlHtmlServiceProvider::classprovider configuration
'Form ' => IlluminateHtmlFormFacade::class,
Facade configuration
The above introduces the Blade template engine - common syntax formats, including blade content. I hope it will be helpful to friends who are interested in PHP tutorials.