thinkphp获取器的使用
模型中操作
public function getZhifuListTextAttr($value, $data) { $value = $value ? $value : (isset($data['zhifu_state']) ? $data['zhifu_state'] : ''); $list = $this->getZhifuList(); return isset($list[$value]) ? $list[$value] : ''; } public function getZhifuList(){ return ['0' => __('Zhifu_state 0'), '1' => __('Zhifu_state 1')]; } |
视图中使用
{$row.zhifu_list_text} |