Zend Framework-在引导程序中访问application.ini中的配置文件值


Zend Framework - access config file values from application.ini inside Bootstrap

我使用的是Zend Framework 1.12,需要从引导程序的_initFunction中访问application.ini中的配置值。

通常,我会在控制器内执行以下操作:

$frontController = Zend_Controller_Front::getInstance();
$options = new Zend_Config($frontController->getParam('bootstrap')->getOptions(), true);
$language = $options->get('interface', false)->language;

然而,在_initFunction内部,这是不起作用的。

我尝试过使用new Zend_Config($this->getOptions(), true);,但它不返回任何数据。

你有解决方案吗?

感谢

以下是可能对您有效的方法:

$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);

APPLICATION_PATH和APPLICATION _ENV是在index.php 上定义的常量