单例模式2014/3/27
写一个简单是单例模式的例子
class Pattern{ Private $array=array(); private Static $instance; Private function __construct(){ } public static function getInstance(){ if(empty(self::$instance)){ self::$instance=new Pattern(); } return self::$instance; } public function setArray($key,$value){ $this->array[$key]=$value; } public function getArray($key){ return $this->array[$key]; } }