Abstract Singleton pattern class
问题 I'm trying to achieve the following goal: Using this general singleton class: abstract class Singleton { private static $instance = null; public static function self() { if(self::$instance == null) { $c = __CLASS__; self::$instance = new $c; } return self::$instance; } } I'd love to be able to create Singleton concrete class such as: class Registry extends Singleton { private function __construct() {} ... } and then use them as: Registry::self()->myAwesomePonyRelatedMethod(); But obliviously