arrayaccess的接口使用,arrayaccess接口getmethods()); //var_dump($reflection->getproperties()); class dbtypes implements arrayaccess{ private $dbtypes = array(); //判定是否存在 public function offsetexists($offset){ return isset($this->dbtypes[$offset]) ? true : false; } //获取一个值 public function offsetget($offset){ if($this->offsetexists($offset)){ return $this->dbtypes[$offset]; }else{ return null; } } //设置一个值 public function offsetset($offset,$value){ $this->dbtypes[$offset] = $value; } //删除一个值 public function offsetunset($offset){ unset($this->dbtypes[$offset]); } } $types = new dbtypes(); echo $types['nosql'];
http://www.bkjia.com/phpjc/965028.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/965028.htmltecharticlearrayaccess的接口使用,arrayaccess接口 ? php // get the methods instance of arrayaccess //get the properties instance of arrayaccess $reflection = new reflectionclass('arra...