How could read application.ini on controller using zend framework

后端 未结 6 512
渐次进展
渐次进展 2021-01-06 23:50

I have these lines in my application.ini

how can I read user in my contrroler

resources.doctrine.dbal.connections.default.parameter         


        
6条回答
  •  天涯浪人
    2021-01-07 00:26

    In this case you should use Zend_Config_Ini class

    $config = new Zend_Config_Ini('/path/to/config.ini','staging',$options);
    

    second parameter is a section in INI file should be loaded ; third parameter is the key to allow modify loaded file.

    You can put out value user this way:

    $config->resources->doctrine->dbal->connections->default->parameters->user;
    

提交回复
热议问题