How could read application.ini on controller using zend framework

后端 未结 6 555
渐次进展
渐次进展 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:42

    To get to the Doctrine container resource, just use :

    $bootstrap = $this->getInvokeArg('bootstrap');
    $doctrine = $bootstrap->getResource('doctrine');
    

    From there you can drill down to the user name of the default connection (you can specify the connection if needed, just pass the name of the connection in the call to getConnection) :

    $username = $doctrine->getConnection()->getUsername();
    

提交回复
热议问题