我使用默认的Zend_Application
设计模式,它在应用程序引导程序中自动加载zend config ini文件,并且我需要在许多模型和控制器中创建ini文件的变量。访问Zend_Application_Bootstrap_Bootstrap的getOptions()
现在,我通过设置解决它的配置对象作为重点为Zend_Registry
:
protected function _initConfig()
{
$config = new Zend_Config($this->getOptions());
Zend_Registry::set('config', $config);
}
一般来说,我不喜欢使用Zend_Registry
,因为它不提供代码自动完成我的IDE,并且很难跟踪我在注册表名称空间中的内容。
是否有另一种方式来访问Zend_Application的配置ini?
谢谢!效果很好 – aporat 2012-02-17 19:43:14