标签:
class car { static $obj = null; private function __construct(){} static function getObj(){ if(is_null(self::$obj)){ self::$obj = new car; } return self::$obj; } function __destruct(){ echo "********************<br>"; } function say(){ echo ‘Hello World!<br>‘; } } $c = car::getObj(); $d = car::getObj(); $e = car::getObj(); $f = car::getObj(); $c = car::getObj(); $c->say(); $f->say();
标签:
原文地址:http://www.cnblogs.com/cyxxzjp/p/5860229.html