单例模式:
<?php class singleton { private static $instance = null; public function __construct() { echo 'This is not a Constructed Class'; } private static function singleton(){ if(!(self::$instance instanceof self)){ self::$instance = new self(); } return self::$instance; } public function test(){ echo 22; } }