thinkphp6.0学习笔记(视图)

(说明:记录的是view的格式)


循环标签 tip:使用下标

{foreach $arr as $k => $i}
<div>
    <span>ID{$k + 1}</span>
    <span>姓名:{$i['name']}</span>
</div>
{/foreach}

volist循环标签
key从1开始,offset从0开始

{volist name="arr" id="v" key="k"  offset="1" length="2"}
    <div>
        <span>ID{$v['id']}</span>
        <span>姓名:{$v['name']}</span>
        <span>下标:{$k}</span>
    </div>
{/volist}

if和switch判断标签

{if $order_status == 0}
    <div>未支付</div>
{elseif $order_status == 1/}
    <div>已支付 待发货</div>
{/if}
{switch $order_status}
    {case 0 }<div>未支付</div>{/case}
    {case 1 }<div>已支付 待发货</div>{/case}
    {case 2 }<div>已发货 待收货</div>{/case}
    {case 3 }<div>已收货 待评论</div>{/case}
    {case 4 }<div>已完成</div>{/case}
{/switch}

包含文件

{include file="public/left" /}

{load href="/static/layui/css/layui.css" /}
{load href="/static/layui/layui.js" /}

(备忘)网址与视图的对应

网址:www.tp.com/index.php/test/idx

thinkphp6.0学习笔记(视图)_第1张图片
thinkphp6.0学习笔记(视图)_第2张图片

你可能感兴趣的:(PHP)