Home >Backend Development >PHP Tutorial >Usage of functions related to thinkPHP template arithmetic operations
This article mainly introduces the usage of functions related to thinkPHP template arithmetic operations, and analyzes thinkPHP's related skills on arithmetic operations and parameter transfer in the form of simple examples. Friends in need can refer to the following
The examples in this article describe ThinkPHP template arithmetic operation related function usage. Share it with everyone for your reference, the details are as follows:
The function is defined as follows:
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>
The parameter received as written above is Array.discount. The required operation does not have the correct result.
Modified the code:
<td>{$vo.price|you=$vo['discount']}</td> <td>{$vo['price']*$vo['discount']/100}</td>
##Both of the above methods are available. It can be seen from this that thinkphp Templates do not support arithmetic operations and parameter passing in object mode.
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website! Related recommendations:thinkphp uses model general data editing to add and delete
Analysis of variable output of ThinkPHP template engine
The above is the detailed content of Usage of functions related to thinkPHP template arithmetic operations. For more information, please follow other related articles on the PHP Chinese website!