| | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | | //获取描述 |