Php Zend配置不';t从application.ini[开发:生产]部分加载设置
我在/application/configs目录中有一个application.ini文件 我在配置文件(除其他选项外)中有如下部分:Php Zend配置不';t从application.ini[开发:生产]部分加载设置,php,zend-framework,config,development-environment,Php,Zend Framework,Config,Development Environment,我在/application/configs目录中有一个application.ini文件 我在配置文件(除其他选项外)中有如下部分: [production] resources.db.params.username = "someuser1" dmp.server.baseUrl = "http://someurl1.com" [staging : production] [testing : production] [development : production] reso
[production]
resources.db.params.username = "someuser1"
dmp.server.baseUrl = "http://someurl1.com"
[staging : production]
[testing : production]
[development : production]
resources.db.params.dbname = "someuser2"
dmp.server.baseUrl = "http://someurl2.com"
我正在Bootstrap.php中加载配置文件
protected function _initConfig() {
$config = new Zend_Config($this->getOptions(), TRUE);
Zend_Registry::set('config', $config);
return $config;
}
在.htaccess文件中,我设置了一个环境:
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteBase /
当我尝试从$config->dmp->server->baseUrl获取变量时,我收到值:
为什么??它应该给我价值:
我正在使用Zend 1.12更改
protected function _initConfig() {
$config = new Zend_Config($this->getOptions(), TRUE);
Zend_Registry::set('config', $config);
return $config;
}
到
改变
到
谢谢你们的建议,你们给我指出了解决方案。“config”索引出现问题,当我将其更改为“appConfig”(或任何其他)时,已加载正确的值。感谢您的建议,您为我指出了解决方案。“config”索引有问题,当我将其更改为“appConfig”(或任何其他)时,已加载正确的值。
protected function _initConfig() {
$config = $this->getOptions();
Zend_Registry::set('config', $config);
return $config;
}