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. Friends in need can refer to the following
This article describes the use of thinkPHP template arithmetic operations with examples 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.
Related recommendations:Detailed introduction to the method of distinguishing 0, null and false in the ThinkPHP template tag eq if
The above is the detailed content of Usage analysis of functions related to thinkPHP template arithmetic operations. For more information, please follow other related articles on the PHP Chinese website!