classUrl{privatestatic$instance=null;public$urls=array();publicstaticfunctiongetInstance(){if(empty(self::$instance)){self::$instance=newself();}returnself::$instance;}publicfunctionset(){$this->urls=array(0,1,2,3,4,5);}}//单例$instance=Url::getInstance();//给普通成员属性赋值$instance->set();print_r($instance->urls);//以后每次取都有值print_r($instance->urls);//同上print_r($instance->urls);//同上
慕森卡
www说
相关分类