合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
>[danger] 获取原始数据的应用示例 + 获取器定义 ~~~ /** * 获取器 性别 * @param [type] $value [description] * @return [type] [description] */ public function getGenderAttr($value) { $status = [0 => '女', 1 => '男', 2 => '保密']; return $status[$value]; } ~~~ + 单选框的选中判断(在模板文件中经常使用) ~~~ // 模型对象 $member = self::find($id); {if $member->getData('gender') == 1} checked {/if} {if $member->getData('gender') == 0} checked {/if} <input type="radio" name="gender" value="1" {if $member->getData('gender') == 1} checked {/if}> <input type="radio" name="gender" value="0" {if $member->getData('gender') == 0} checked {/if}> ~~~ + 下拉框的选中判断 ~~~ <select name="rank"> <option value="-1" {if $data->getData('rank') == -1} selected {/if}>私有</option> <option value="0" {if $data->getData('rank') == 0} selected {/if}>待审核</option> <option value="1" {if $data->getData('rank') == 1} selected {/if}>公开浏览</option> </select> ~~~