Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of inheriting operation of Laravel framework template

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "Laravel Framework Template Inheritance Operation Method". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "Laravel Framework Template Inheritance Operation Method" can help you solve the problem.

Laravel and ThinkPHP load similar, ThinkPHP 3.2 use

occupied use

Laravel is just different in English.

For example, for a page, we're going to introduce a bootstrap page at the head.

Document @yield('content')

Place this file in the root or custom directory of the view and name it app.blade.php for placeholder use

@yield ('placeholder name')

How to inherit it, see the following code

@extends ('app ')@section ('content') content @stop

this will not only

Demonstrate if judgment and loop control

The code in the controller is l:

$data = ['a','b','c']; return view('sites.iffor',compact('data'));

Then we can look at the view as follows

@extends('app')@section('content') @if(count($data)) @foreach($data as $v) {{ $v }} @endforeach @endif@stop The content of "Laravel Framework Template Inheritance Operation" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report