public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new Singleton();
     }
     return self::$_instance;
 }
예제 #2
0
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new Singleton();
     }
     return self::$_instance;
 }
예제 #3
0
파일: test.php 프로젝트: tanhaipeng/APP_API
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #4
0
 public static function init()
 {
     if (self::$_instance == null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #5
0
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         //instanceof用于检测对象与类的从属关系,is_subclass_of对象所属类是否类的子类
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #6
0
 static function getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new Singleton();
     } else {
         return self::$_instance;
     }
 }
예제 #7
0
 /**
  * 获得实例
  * @return null
  */
 public static function getInstance()
 {
     $class = __CLASS__;
     if (!self::$_instance instanceof $class) {
         return self::$_instance = new $class();
     }
     return self::$_instance;
 }
예제 #8
0
파일: singleton.php 프로젝트: nergal/donnie
 /**
  * Сброс инстанции
  *
  * @static
  * @return void
  */
 public static function reset()
 {
     self::$_instance = NULL;
 }