Home > Article > Backend Development > laravel template yeild use
Today I encountered a small problem related to templates. Different titles need to be displayed on different pages, and different hyperlinks need to be displayed according to routing.
So, I carefully checked laravel's template usage instructions, and it turned out to be very powerful.
Let’s go directly to my solution.
Define a yeild in the template. When other pages inherit, dynamic content will be passed into this designated area:
@yield('title')
#获取当前页面路由,判断是否是登陆页面 @if (Request::path()=='login') 没有账号? 去注册@else 已有账号? 去登陆@endif
@section('title', '关于我们')
The above is the detailed content of laravel template yeild use. For more information, please follow other related articles on the PHP Chinese website!