How do i access the url variable defined in the Zend Framework config.ini -
[dev] great.url="www.google.com" [test : dev] great.url="www.yahoo.com" [prod : test] great.url="www.aol.com"
i have own functions return config of environment used(dev,test,or prod) . problem $myclassinstance->getconfig()->great->url;
(when returning url correctly in dev) in test returning notice "notice: trying property of non-object in file test.php on line no 19" error coming due empty of statement ($myclassinstance->getconfig()->great->url;)
.it returning correctly in dev . might problem.
it must defaulting dev. fix it, need this:
$config = new zend_config_ini('/path/to/config.ini', 'prod'); $myclassinstance->setconfig($config);
or depending on how have things setup:
$myclassinstance->config = $config;
then code should work:
$myclassinstance->getconfig()->great->url;
documentation here: http://framework.zend.com/manual/en/zend.config.adapters.ini.html
Comments
Post a Comment