<?phpclassLtObjectUtil{static$instances;staticpublicfunctionsingleton($className,$autoInited=true){if(empty($className)){trigger_error('empty class name');returnfalse;}$key=strtolower($className);if(isset(self::$instances[$key])){returnself::$instances[$key];}elseif(class_exists($className)){$newInstance=new$className;if($autoInited&&method_exists($newInstance,'init')){$newInstance->init();}self::$instances[$key]=$newInstance;return$newInstance;}else{returnfalse;}}}