From abb66a0e799e7ca613e8967a304e7c5ed00e034e Mon Sep 17 00:00:00 2001 From: chengkun <chengkun@ishangstudy.com> Date: Fri, 30 May 2025 11:37:48 +0800 Subject: [PATCH] 提交 --- app/public/common.php | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/public/common.php b/app/public/common.php index 6d0af4e..7dfdb59 100644 --- a/app/public/common.php +++ b/app/public/common.php @@ -1105,42 +1105,33 @@ } public function MODEL($ModelName = NULL, $ModelPath = NULL) { -// var_dump($ModelName); -// var_dump($ModelPath); require_once(APP_PATH . 'app/public/action.class.php'); if ($ModelName) { if ($ModelPath) { if (file_exists($ModelPath . '/' . $ModelName . '.class.php')) { - require_once($ModelPath . '/' . $ModelName . '.class.php'); } else { - return NULL; } } else { - $ModelPath = APP_PATH . 'app/model/'; $ModelFileName = $ModelName . '.model.php'; if (file_exists($ModelPath . $ModelFileName)) { - require_once($ModelPath . $ModelFileName); } else { - return NULL; } } $ModelName = $ModelName . '_model'; } else { - $ModelName = 'model'; } -// var_dump($ModelName); -// exit(); + if (!class_exists($ModelName)) { return NULL; } - $Model = new $ModelName($this->db, $this->def, array('uid' => $this->uid, 'username' => $this->username, 'usertype' => $this->usertype), $this->tpl); - return $Model; + + return new $ModelName($this->db, $this->def, array('uid' => $this->uid, 'username' => $this->username, 'usertype' => $this->usertype), $this->tpl); } //获取描述 -- Gitblit v1.9.0