TP模板中输出方法:
<!-- <?php
echo $name.'性别:'.$sex;
?> -->
<!-- 模板输出 -->
<!-- {$me['name']}
{$me.age}
运算必须使用中括号方式</br>
{$me['age']+1}
</br>
md5加密:
{$me['name']|md5}
</br>
输出格式控制:
{$me['name']|md5|substr=0,5}
-->
<!-- ###代表标量本身 -->
<!-- {$now|date='Y-m-d H:i:s',###}
</br> -->
<!-- 循环 -->
<!-- volist循环:
<volist name='person' id='data' offset='1' length='3' empty='无数据'>
{$data['name']}------{$data['age']}</br>
</volist> -->
<!-- </br>
foreach循环:</br>
<foreach name='person' item='data'>
{$data['name']}------{$data['age']}</br>
</foreach>
</br> -->
<!-- eq = neq != gt > egt >= lt < elt<= heq === nheq !== comparison默认小于</br> -->
<!-- for循环:</br>
<for start='1' end='10' comparison='elt' name='k'> {$k}</br>
</for> -->
<!-- <br/>
if判断:<br/>
<if condition="$num gt 10">num大于10
<elseif condition="$num lt 10" />num小于10
<else />num等于10
</if> -->
<!--
<br/>
switch判断
<br/>
<switch name='name'>
<case value='laoshi'>老师让小明滚出去 </case>
<case value='xiaohong|xiaohuang'>同学让小明滚出去</case>
<default/>小明自己滚出去
</switch> -->
<!-- <br/> -->
<!-- 比较标签 name='变量名' value='比较的值' compare通用-->
<!-- <eq name='num' value='10'>num!=12</eq>
<eq name='num' value='10'>num=10<else/>num!=10</eq>
<compare name='num' value='10' type='eq'>num=10<else/>num!=10</compare> -->
<!-- 区间标签 in notin between notbetween range-->
<!-- <in name='num' value='1,2,3,4'>在这区间</in>
<notin name='num' value='1,2,4'>不在这个区间<else/>在这个区间</notin><br/>
<between name='num' value='1,10'>在1~10之间</between>
<notbetween name='num' value='10,100'>不在10-100之间</notbetween>
<range name='num' value='1,11,12' type='in'>rang通用判断in和notin</range> -->
<!-- <br/> -->
<!-- 三元运算符 -->
<!-- {$num>11?'大于11':'不大于11'} -->
<!-- <foreach name='person' item='data'>
<egt name='data.age' value='18'>{$data.name}已经成年了<else/>{$data.name}未成年</egt><br/>
</foreach> -->
<!-- 调用原生php代码 -->
<!-- <php>echo $person[1][name]</php> -->
网友评论