Ejemplo n.º 1
0
 /**
  * 静态方法,返回数据库连接实例
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new MySql();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * Get instance returns the currently instantiated object of this DB class.  
  * This forces only one connection to the MySQL server
  * @return DB object
  */
 public static function Instance()
 {
     global $config;
     if (!self::$instance) {
         self::$instance = new self($config['database']);
     }
     return self::$instance;
 }