tp5 view模板中 判断一个值是否在某个数组内 复选框用到了
{foreach $serviceInfo as $v} <div style="display: inline-block;margin-right: 10px;"> <input type="checkbox" value="{$v.service_item}" id="checkbox-{$v.id}" {in name="$v.id"value="$arr" } checked {/in}> <label for="checkbox-{$v.id}">{$v.service_item}</label> </div> {/foreach}
$serviceInfo = model('Service')->order('update_time desc')->select(); $this->assign('serviceInfo', $serviceInfo); $arr = [1,3]; $this->assign('arr', $arr); return view();
{in name="vo.id" value="$data"}checked="checked"{/in}
╰︶﹉⋛⋋⊱⋋๑๑⋌⊰⋌⋚﹉︶╯