Get a consistent application environment in the Zend Framework

I am new to Zend Framework and I want to know how to get the application environment in my controller.

I read on the forum to use: echo getenv('APPLICATION_ENV'); but it does not work.

+6
php zend-framework
source share
2 answers

Since APPLICATION_ENV is a constant, you can access it simply:

 echo APPLICATION_ENV; 

But the question is, why do you need this in the controller.

+20
source share

There is another way to get the environment name. This is a little more OO friendly for those of us who prefer to avoid globally defined constants, but I'm not quite sure how to do this:

 $myEnvName = $zendApplicationInstance->getEnvironment(); 

The question is how to get a link to $myEnvName - suggestions are welcome.

+2
source share

All Articles