标签:
class single{ //设置成受保护的属性 protected static $ins = null; public static function getIns(){ if(self::$ins == null){ self::$ins = new self(); } return self::$ins; } //protected 防止通过new实例化对象; //final 防止被继承 final protected function __construct() { } /** * 禁止clone产生对象 */ final protected function __clone() { } }
标签:
原文地址:http://www.cnblogs.com/wtb123456/p/4234796.html