PHP单例模式

单例模式:
<?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; } }

  

posted on 2016-08-10 11:17  铁轨嘴上飘  阅读(116)  评论(0编辑  收藏  举报

导航