function init() { parent::init(); $q = $_GET['q']; $model = "\\Content\\{$q}"; $this->obj = new $model(); $this->data['fields'] = $this->obj->fields; $allowFields = ['title', 'status']; $int = ['status']; foreach ($this->data['fields'] as $k => $v) { $allowFields[] = $k; if ($v['int'] === true) { $int[] = $k; } } /** * 允许保存到数据库的字段 * @var array $allowFields */ $this->obj->allowFields = $allowFields; $this->obj->int = $int; $this->jump = url($this->jump, $_GET); $this->data['type'] = $this->obj->title; }
function init() { parent::init(); $this->obj = new PostModel(); }
function init() { parent::init(); // $this->obj = new Model; }