<select name="role_id" id="" class="form-control" required> {volist name="roleData" key="key" id="vo"} <option value="{$vo.id}" {php}if(isset($data['role_id'])){ {/php} {$data['role_id']==$vo['id'] ? 'selected' : ''}{php}}{/php}>{$vo['name']}</option> {/volist}
<select name="role_id" id="" class="form-control" required> {volist name="roleData" key="key" id="vo"} {eq name="vo['id']" value="$data.role_id"} <option value="{$vo['id']}" selected>{$vo['name']}</option> {else/} <option value="{$vo['id']}">{$vo['name']}</option> {/eq} {/volist} </select>
注意:
select()出来的结果才可以volist