加入收藏在线咨询
位置:主页 >

亚太娱乐app:php Smarty 字符比较代码

作者:dudu时间:11月23日浏览:


eq相等,

ne、neq不相等,

gt大年夜于,

lt小于,

gte、ge大年夜于即是,

lte、le 小于即是,

not非, mod求模。

is [not] div by是否能被某数整除,

is [not] even是否为偶数,

$a is [not] even by $b即($a / $b) % 2 == 0,

is [not] odd是否为奇,

$a is not odd by $b即($a / $b) % 2 != 0 示例:

equal/ not equal/ greater than/ less than/ less than or equal/ great than or equal/后面的就不用说了

Smarty 中的 if 语句和 php 中的 if 语句一样机动易用,并增添了几个特点以合适模板引擎. if 必须于 /if 成对呈现. 可以应用 else 和 elseif 子句. 可以应用以下前提修遁词:eq、ne、neq、gt、lt、lte、le、gte、ge、is even、is odd、is not even、is not odd、not、mod、div by、even by、odd by、==、!=、>、=. 应用这些修遁词时必须和变量或常量用空格格开.

Example 7-11. if statements

例 7-11. if 语句演示

{if $name eq "Fred"}

Welcome Sir.

{elseif $name eq "Wilma"}

Welcome Ma'am.

{亚太娱乐appelse}

Welcome, whatever you are.

{/if}

{* an example with "or" logic *}

{if $name eq "Fred" or $name eq "Wilma"}

...

{/if}

{* same as above *}

{if $name == "Fred" || $name == "Wilma"}

...

{/if}

{* the following syntax will NOT work, conditional qualifiers

must be separated from surrounding elements by spaces *}

{if亚太娱乐app $name=="Fred" || $name=="Wilma"}

...

{/if}

{* parenthesis are allowed *}

{亚太娱乐appif ( $amount1000 ) and $volume >= #minVolAmt#}

...

{/if}

{* you can also embed php function calls *}

{i亚太娱乐appf count($var) gt 0}

...

{/if}

{* test if values are even or odd *}

{if $var is even}

...

{/if}

{if $var is odd}

...

{/if}

{if $var is not odd}

...

{/if}

{* test if var is divisible by 4 *}

{if $var is div by 4}

...

{/if}

{* test if var is even, grouped by two. i.e.,

0=even, 1=even, 2=odd, 3=odd亚太娱乐app, 4=even, 5=even, etc. *}

{if $var is even by 2}

...

{/if}

{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}

{if $var is even by 3}

...

{/if}

电话:13866999966
联系人:王经理
Q Q:88996699
邮箱:admin@dede58.com
地址:中国XX省XX市XX路XX号