ZF2 - How to access config param in controller?

For programming and general questions on Zend Framework
Post Reply
m_software
Posts: 1
Joined: Mon Jan 07, 2013 11:56 am

ZF2 - How to access config param in controller?

Post by m_software » Mon Jan 07, 2013 11:59 am

Hi,

I defined array element 'tmp_upload_path' => __DIR__.'../../public/tmp_upload' in config (global.php). How to access it in controller action? I need something like this: $config->get('tmp_upload_path').
Thanks for help.

dafap
Posts: 7
Joined: Tue Jan 15, 2013 9:18 pm
Location: Langon, Aquitaine, France

Re: ZF2 - How to access config param in controller?

Post by dafap » Tue Jan 15, 2013 9:24 pm

In Controller :

Code: Select all

$config = $this->getServiceLocator()->get('Config');
$config is an array.

Post Reply