예제 #1
0
	/**
	 * 返回当前终级类对象的实例
	 * @param $db_config 数据库配置
	 * @return object
	 */
	public static function get_instance($db_config = '') {
		if($db_config == '') {
			$db_config = pc_base::load_config('database');
		}
		if(db_factory::$db_factory == '') {
			db_factory::$db_factory = new db_factory();
		}
		if($db_config != '' && $db_config != db_factory::$db_factory->db_config) db_factory::$db_factory->db_config = array_merge($db_config, db_factory::$db_factory->db_config);
		return db_factory::$db_factory;
	}
예제 #2
0
 /**
  * 返回当前终级类对象的实例
  * @param $db_config 数据库配置
  * @return object
  */
 public static function get_instance($db_config = '')
 {
     if ($db_config == '') {
         $db_config = array('default' => array('hostname' => DB_HOSTNAME, 'port' => DB_PORT, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'tablepre' => AUTO_TABLE_PREFIX, 'charset' => DB_CHARSET, 'type' => 'mysql', 'debug' => DEBUG, 'pconnect' => 0, 'autoconnect' => 0));
     }
     if (db_factory::$db_factory == '') {
         db_factory::$db_factory = new db_factory();
     }
     if ($db_config != '' && $db_config != db_factory::$db_factory->db_config) {
         db_factory::$db_factory->db_config = array_merge($db_config, db_factory::$db_factory->db_config);
     }
     return db_factory::$db_factory;
 }
예제 #3
0
 /**
  * 返回当前终级类对象的实例
  * @param $db_config 数据库配置
  * @return object
  */
 public static function get_instance($db_config = '')
 {
     if ($db_config == '') {
         $db_config = (include WX_PATH . 'include' . DIRECTORY_SEPARATOR . 'database.php');
     }
     if (db_factory::$db_factory == '') {
         db_factory::$db_factory = new db_factory();
     }
     if ($db_config != '' && $db_config != db_factory::$db_factory->db_config) {
         db_factory::$db_factory->db_config = array_merge($db_config, db_factory::$db_factory->db_config);
     }
     return db_factory::$db_factory;
 }