码迷,mamicode.com
首页 > 其他好文 > 详细

blade常用语法

时间:2020-06-26 16:17:10      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:pac   init   use   func   width   app   local   ini   nat   


<?php

namespace App\Http\Controllers;

use http\Env\Request;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    public function index($count){
        $json = [‘name‘=>‘小辉‘,‘age‘=>20];
        return view(‘welcome‘,[‘html‘=>‘<p>hello</p>‘,‘json‘=>$json,‘count‘=>$count]);
    }
}

 

视图层中测试语法

<!DOCTYPE html>
<html lang="{{ str_replace(‘_‘, ‘-‘, app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title></title>
        <!-- Fonts -->

    </head>
    <body>
    {!! $html !!}

    ‘{@json($json)}‘

    @if($count==1)
        等于一
    @else
        不等于一
    @endif

    @unless($count==1)
        这个数不等于1
    @endunless

    @isset($count)
        $count有定义
    @endisset

    @empty($count)
        $count等于空
    @endempty
    </body>
</html>

  

  

blade常用语法

标签:pac   init   use   func   width   app   local   ini   nat   

原文地址:https://www.cnblogs.com/jichenghui/p/13195152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!