/** * 构造函数 */ public function __construct() { //必须继承父类控制器 parent::__construct(); //实例化模型 $this->model = Mining_Model::instance(); }
/** * 单例模式 * @return Mining_Model */ public static function &instance() { if (!isset(self::$instance)) { // Create a new instance self::$instance = new Mining_Model(); } return self::$instance; }