读书人

Zend的代码

发布时间: 2012-12-27 10:17:10 作者: rapoo

Zend的代码。
1.

 if ($options instanceof Zend_Config) {            $options = $options->toArray();        }


2.
$this->setOptions($options);

3.
    public function setOptions(array $options)    {        $methods = get_class_methods($this);        foreach ($options as $key => $value) {            $method = 'set' . ucfirst($key);            if (in_array($method, $methods)) {                $this->$method($value);            }        }        return $this;    }



4.
    public function setNamespace($namespace)    {        $this->_namespace = rtrim((string) $namespace, '_');        return $this;    }


5.
 public function setBasePath($path)    {        $this->_basePath = (string) $path;        return $this;    }

读书人网 >编程

热点推荐