Utils.php
class Utils extends Backend { static function getRoomnum(){ $model = Room::query("select num from ms_room"); return $model; } }
//自定义下拉框数据关联
controller
$this->view->assign("roomnumList", Utils::getRoomnum());
页面
<select id="c-room_id" data-rule="required" class="form-control selectpicker" name="row[room_id]"> {foreach name="roomnumList" item="vo"} <option value="{$vo.num}" {in name="key" value="美团民宿"}selected{/in}>{$vo.num}</option> {/foreach} </select>
- THE END -
最后修改:2022年2月28日