《PHP學(xué)習(xí):thinkPHP模板算術(shù)運(yùn)算相關(guān)函數(shù)用法分析》要點(diǎn):
本文介紹了PHP學(xué)習(xí):thinkPHP模板算術(shù)運(yùn)算相關(guān)函數(shù)用法分析,希望對(duì)您有用。如果有疑問,可以聯(lián)系我們。
相關(guān)主題:thinkphp教程
本文實(shí)例講述了thinkPHP模板算術(shù)運(yùn)算相關(guān)函數(shù)用法.分享給大家供大家參考,具體如下:PHP實(shí)例
函數(shù)定義如下:PHP實(shí)例
function you($num1,num2){ echo $num1*$num2/100; }
<volist name="list" id="vo"> <tr> <td>{$vo.price|you=$vo.discount'}</td>或者:{$vo.price*$vo.discount/100} </tr> </volist>
如上寫接收的參數(shù)是Array.discount.需要的運(yùn)算沒有正確結(jié)果.PHP實(shí)例
修改了一下代碼:PHP實(shí)例
<td>{$vo.price|you=$vo['discount']}</td> <td>{$vo['price']*$vo['discount']/100}</td>
以上兩種方式都可以,由此可以看出,thinkphp模板不支持object模式的算術(shù)運(yùn)算和參數(shù)傳遞.PHP實(shí)例
更多關(guān)于thinkPHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《ThinkPHP入門教程》、《ThinkPHP常用方法總結(jié)》、《php操作office文檔技巧總結(jié)(包括word,excel,access,ppt)》、《PHP中cookie用法總結(jié)》、《smarty模板入門基礎(chǔ)教程》及《PHP模板技術(shù)總結(jié)》.PHP實(shí)例
希望本文所述對(duì)大家基于ThinkPHP框架的PHP程序設(shè)計(jì)有所幫助.PHP實(shí)例
轉(zhuǎn)載請(qǐng)注明本頁網(wǎng)址:
http://www.snjht.com/jiaocheng/5689.html