/** * 静态方法,返回数据库连接实例 */ public static function getInstance() { if (self::$instance == null) { self::$instance = new MySql(); } return self::$instance; }
/** * 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; }