码迷,mamicode.com
首页 > Web开发 > 详细

PHP单例模式

时间:2016-08-10 12:25:04      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

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

  

PHP单例模式

标签:

原文地址:http://www.cnblogs.com/best-jobs/p/5756007.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!