标签:
功能:条件判断(分支)
基本语法:
{if}
{elseif}
{else}
{/if}
demo4.html示例代码:
<!DOCTYPE html> <html> <head> <meta charset=’utf-8′> <title></title> </head> <body> {if $i==1} 吃饭 {elseif $i==2} 读书 {elseif $i==3} 敲代码 {else} 睡觉 {/if} </body> </html>
demo4.php
<?php require “smarty/Smarty.class.php”; $smarty = new Smarty(); $i = ‘2’; $smarty -> assign(‘i’,$i); $smarty -> display(“demo4.html”);
夺命雷公狗---Smarty NO:08 if–elseif–else函数
标签:
原文地址:http://www.cnblogs.com/leigood/p/5033103.html