In the html in thinkphp
I want to determine whether $huodong.id and $vo.xueduanid are equal.
xueduanid:{$vo.xueduanid}huodongid:{$huodong.id}
Output xueduanid:1huodongid:1
<if condition="$vo.xueduanid == $huodong.id">eee</if>
But eee cannot be output like this. Why? They are all 1. They should be equal? Wrong type? The values in the database are all int types. .
<if condition="$vo.xueduanid == 1">eee</if>can output eee
<if condition="$huodong.id==1">eee</if> ;can output eee
伊谢尔伦2017-05-17 09:57:51
Use directlyeq
<eq name="vo.xueduanid" value="huodong.id">
相等
<else/>
不等
</eq>
PHP中文网2017-05-17 09:57:51
<if condition="$vo.xueduanid eq $huodong.id">
equal
<else/>
not equal
</if>
習慣沉默2017-05-17 09:57:51
Actually, TP’s template engine has a bit of a bug. The above is theoretically correct, but in fact it has to be written as
<if condition="$vo.xueduanid eq $huodong['id']">eee</if>
The latter variable must be written in array form, otherwise an error will occur when converting it into PHP code.