public function __init() { parent::__init(); $this->table = strtolower(MODULE); $this->fieldPrefix = $this->table . "_"; $this->model = \Model\ModelManage::findModel($this->table, 'model_name'); if (empty($this->model)) { $this->error('不存在的模型'); } $this->assign('fieldPrefix', $this->fieldPrefix); }
public function __init() { parent::__init(); if (empty($_FILES)) { $this->callBack('没有数据上传', '0'); } /** * 获取允许上传的文件格式 */ $result = \Model\Option::getOptionRange('upload'); foreach ($result as $key => $value) { $this->allowFormat[$value['option_name']] = json_decode($value['value'], true); } /** * 获取配置文件的上传目录 */ $this->uploadPath = PES_PATH . \Core\Func\CoreFunc::loadConfig('UPLOAD_PATH'); /** * 分析上传目录 */ $this->uploadFileType = pathinfo($_FILES['file']['name']); /** * 存储路径 */ $this->savePath = $this->uploadPath . date('/Ymd/'); /** * 移除完整的目录信息 * 以便记录入库 */ $this->recordPath = str_replace(PES_PATH, "", $this->savePath); /** * 判断上传目录是否存在 */ if (is_dir($this->uploadPath) === false) { mkdir($this->uploadPath); fopen("{$this->uploadPath}/index.html", 'w'); } /** * 创建以日期形式存储目录 */ if (is_dir($this->savePath) === false) { mkdir($this->savePath); fopen("{$this->savePath}/index.html", 'w'); } }
public function __init() { parent::__init(); //表名 $this->table = strtolower(MODULE); //表前缀 $this->fieldPrefix = $this->table . "_"; $this->assign('fieldPrefix', $this->fieldPrefix); //验证模型是否存在 $this->model = \Model\ModelManage::findModel($this->table, 'model_name'); if (empty($this->model)) { $this->error('不存在的模型'); } $this->modelThemePrefixPath = THEME_PATH . '/' . MODULE . '/' . MODULE; //获取模型的字段列表 $fieldShowType = ACTION == 'index' ? 'field_list' : 'field_form'; $this->field = \Model\Field::fieldList($this->model['model_id'], ['field_status' => '1', $fieldShowType => '1']); }
public function __init() { parent::__init(); $this->assign('sitetile', \Model\Option::findOption('sitetitle')['value']); $this->assign('signup', \Model\Option::findOption('signup')['value']); }