StupidBeauty
Read times:1381Posted at: - no title specified

转载 ThinkPHP 模板中使用算术运算符

ThinkPHP模板中是可以使用算术运算符的,但是要注意不可以使用点号语法,所以对于复合类型要使用数组语法。例如“ < td > {$vo['quantity']*$vo['itemDayPassAmount']} </ td > ”。

http://www.5idev.com/p-thinkphp_tpl_operators.shtml

亮点:

注意

在模板中使用数学运算符时,不能使用点号语法和常规的函数用法。所以如果是查询结果等,尽量使用数组语法,如:

// 错误用法

{$user.score+10}

// 正确用法

{$user['score']+10}

{$user['score']*$user['level']}

// 错误用法

{$user['score']|myFun*10}

// 正确用法

{$user['score']+myFun($user['level'])}

Your opinions

Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands