Home  >  Article  >  Backend Development  >  Usage analysis of functions related to thinkPHP template arithmetic operations

Usage analysis of functions related to thinkPHP template arithmetic operations

不言
不言Original
2018-05-04 13:53:261220browse

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;
}


 
{$vo.price|you=$vo.discount'}或者:{$vo.price*$vo.discount/100}
 

The parameter received as written above is Array.discount. The required operation does not have the correct result.

Modified the code:

{$vo.price|you=$vo['discount']}
{$vo['price']*$vo['discount']/100}

##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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn