public function __construct($connect_info, $table, $connect_type = 'IPdo') { $class = $connect_type; $this->obj_db = new $class(); $info = Grug_Registry::get($connect_info); $this->obj_db->connect($info['host'], $info['port'], $info['user'], $info['passwd'], $info['dbname']); $this->table = $table; }
private function _initDbConfig() { //导入配置文件 $db_conf = parse_ini_file($this->base_dir . "/Conf/db.conf", true); //此配置文件最好不要和代码放在一起,可放在服务器其他位置 foreach ($db_conf as $key => $value) { Grug_Registry::set($key, $value); } }