ZF2 - How to access config param in controller?

For programming and general questions on Zend Framework

ZF2 - How to access config param in controller?

Postby m_software on 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.
m_software
 
Posts: 1
Joined: Mon Jan 07, 2013 11:56 am

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

Postby dafap on Tue Jan 15, 2013 9:24 pm

In Controller :
Code: Select all
$config = $this->getServiceLocator()->get('Config');

$config is an array.
dafap
 
Posts: 2
Joined: Tue Jan 15, 2013 9:18 pm


Return to Zend Framework

Who is online

Users browsing this forum: Google [Bot] and 6 guests