PHP 8.6.0 Beta 3 is available for testing

Yaf_Request_Abstract::getEnv

(Yaf >=1.0.0)

Yaf_Request_Abstract::getEnvRetrieve an ENV variable

Açıklama

public function Yaf_Request_Abstract::getEnv(string $name, mixed $default = ?): mixed

Retrieves a ENV variable.

Bağımsız Değişkenler

name

The variable name.

default

The value to return if the variable is not found.

Dönen Değerler

The variable value, or default if it is not found.

Örnekler

Örnek 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);
    }
}
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

string(11) "development"

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top