(Yaf >=1.0.0)
Yaf_Request_Abstract::getEnv — Retrieve an ENV variable
Retrieves a ENV variable.
nameThe variable name.
defaultThe value to return if the variable is not found.
The variable value, or default if it is not found.
Приклад #1 Yaf_Request_Abstract::getEnv() example
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
// Assuming the process runs with APPLICATION_ENV=development
$env = $this->getRequest()->getEnv("APPLICATION_ENV", "production");
var_dump($env);
}
}
?>Поданий вище приклад виведе щось схоже на:
string(11) "development"