public static function getInstance($conf = null) { if (!self::$_instance instanceof self) { self::$_instance = new self($conf); } return self::$_instance; }
public static function init($server = null, $username = null, $password = null, $database = null, $is_permantent = false) { if (self::$_instance == null) { self::$_instance = new Mysql($server, $username, $password, $database, $is_permantent); } return self::$_instance; }
/** * 静态方法,单例访问统一入口 * @return Singleton返回应用中的唯一对象实例 */ public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function init() { if (null === self::$_instance) { self::$_instance = new Mysql(); } return self::$_instance; }
/** static public function get_instance * Returns the singleton instance * of the MySQL Object as a reference * * @param array optional configuration array * @action optionally creates the instance * @return MySQL Object reference */ public static function get_instance($config = null) { try { if (is_null(self::$_instance)) { self::$_instance = new Mysql($config); } self::$_instance->test_connection(); self::$_instance->_log(__METHOD__ . ' --------------------------------------'); } catch (MySQLException $e) { throw $e; } return self::$_instance; }