shasi kanth
shasi kanth

Reputation: 7094

Get application environment constant in Zend Framework

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.

Upvotes: 8

Views: 9075

Answers (2)

Memethief
Memethief

Reputation: 21

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.

Upvotes: 2

Vika
Vika

Reputation: 3285

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.

Upvotes: 24

Related Questions