Ask a question about thinkphp syntax
滿天的星座
滿天的星座 2017-05-17 09:55:51
0
4
538

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

滿天的星座
滿天的星座

reply all(4)
仅有的幸福

== changed to eq

伊谢尔伦

Use directlyeq

<eq name="vo.xueduanid" value="huodong.id">
相等
<else/>
不等
</eq>
Ty80

<if condition="$vo.xueduanid eq $huodong.id">
equal
<else/>
not equal
</if>

習慣沉默

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!