i am new to Zend Framework and i want to know how to get the application environment in my controller.
I read in a forum to use: echo getenv('APPLICATION_ENV');
but it does not work.
Since APPLICATION_ENV
is a constant, you can access it simply with:
echo APPLICATION_ENV;
But the question is why would you need it in your controller.
There is another way to get the environment name. It's a little more OO-friendly for those of us who prefer to avoid globally defined constants, but I'm not quite sure how to get at it:
$myEnvName = $zendApplicationInstance->getEnvironment();
The question here is how to get the reference to $myEnvName
-- suggestions welcome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With