search

Home  >  Q&A  >  body text

Ask a question about thinkphp syntax

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

滿天的星座滿天的星座2791 days ago579

reply all(4)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-17 09:57:51

    == changed to eq

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-17 09:57:51

    Use directlyeq

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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-17 09:57:51

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

    reply
    0
  • 習慣沉默

    習慣沉默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.

    reply
    0
  • Cancelreply