4. 视图balde的初级用法

目录

视图层

app.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Zhoujiping.com</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
    @yield('header')
    @yield('content')
    @yield('footer')
</body>
</html>

about/index.balde.php

@extends('app')

@section('header')
Here is header
@endsection

@section('content')
Here is content
@endsection

条件判断

@extends('app')

@section('content')
    @if($firstName == 'kuker')
        <h1>first name is {{ $firstName }}</h1>
    @elseif($lasrName == 'chou' )
        <h1>last name is $lastname</h1>
    @else
        什么龟??
    @endif
@endsection

循环

@extends('app')

@section('content')
    @if(count($users > 0))
    <ul>
         @foreach($users as $user)
            <li>{{ $user }}</li>
        @endforeach
    </ul>
    @endif
@endsection
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容