public static function getInstance() { if (is_null(self::$_instance)) { self::$_instance = new Singleton(); } return self::$_instance; }
public static function getInstance() { if (self::$_instance === NULL) { self::$_instance = new Singleton(); } return self::$_instance; }
public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
public static function init() { if (self::$_instance == null) { self::$_instance = new self(); } return self::$_instance; }
public static function getInstance() { if (!self::$_instance instanceof self) { //instanceof用于检测对象与类的从属关系,is_subclass_of对象所属类是否类的子类 self::$_instance = new self(); } return self::$_instance; }
static function getInstance() { if (self::$_instance == null) { self::$_instance = new Singleton(); } else { return self::$_instance; } }
/** * 获得实例 * @return null */ public static function getInstance() { $class = __CLASS__; if (!self::$_instance instanceof $class) { return self::$_instance = new $class(); } return self::$_instance; }
/** * Сброс инстанции * * @static * @return void */ public static function reset() { self::$_instance = NULL; }