{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}