[php]php设计模式 Singleton(单例模式)
摘要:
1 <?php 2 /** 3 * 单例模式 4 * 5 * 保证一个类仅有一个实例,并提供一个访问它的全局访问点 6 * 7 */ 8 class Singleton 9 {10 staticprivate$_instance=null;11 12 privatefunction __construct()13 {14 }15 16 staticpublicfunction getInstance()17 {18 if(is_null(self::$_instance)) {19 self::$_instance=new S... 阅读全文
posted @ 2011-06-15 20:41
bluefrog
阅读(6164)
评论(3)
推荐(1)
浙公网安备 33010602011771号