Rumah >pembangunan bahagian belakang >tutorial php > 对单例对象的1点疑惑
对单例对象的一点疑惑
<br /> static function instance($type = 'op')<br /> {<br /> $class = 'blog';<br /> if (!isset(self::$_instance)) {<br /> $_tmp = new $class();<br /> self::$_instance = $_tmp;<br /> $tmp = null;<br /> }<br /> return self::$_instance;<br /> }<br />