search

Home  >  Q&A  >  body text

Can the elseif of if judgment be repeated in thinPHP template?

In the thinkPHP template, when judging multiple intervals, can I repeat multiple elseifs as shown below? If so, is this the best way to judge multiple intervals?

{if($staff.age<30)}Young {elseif($staff.age<40)/}Middle-aged {elseif($staff.age<50)/} Middle-aged and elderly {elseif($staff.age<60)/}elderly {else/}retired{/if}

SynnSynn1390 days ago1097

reply all(2)I'll reply

  • 灭绝师太

    灭绝师太2021-02-02 08:54:31

    The multi-directional process branch structure can be completed in this way, which is optimal~

    reply
    0
  • Synn

    Got it, thank you, Master~

    Synn · 2021-02-02 15:45:07
  • Cancelreply