PHP 8.6.0 Beta 3 is available for testing

Yaf_Config_Simple::__construct

(Yaf >=1.0.0)

Yaf_Config_Simple::__constructConstructor of Yaf_Config_Simple

Açıklama

publicfunction Yaf_Config_Simple::__construct(array $values, bool $readonly = false)

Creates a new Yaf_Config_Simple instance from an array of configuration values.

Bağımsız Değişkenler

values

An array of configuration values.

readonly

Whether the configuration should be read-only. Defaults to false (writable).

Dönen Değerler

No value is returned.

Örnekler

Örnek 1 Yaf_Config_Simple::__construct() example

<?php
$config = new Yaf_Config_Simple([
    'application' => ['name' => 'MyApp', 'env' => 'production'],
    'database'    => ['host' => 'localhost', 'port' => 3306],
]);

echo $config->application->name, "\n";
echo $config->database->host, "\n";

// The optional second argument makes the configuration read-only
$frozen = new Yaf_Config_Simple(['env' => 'testing'], true);
var_dump($frozen->readonly());
?>

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

MyApp
localhost
bool(true)

Ayrıca Bakınız

add a note

User Contributed Notes

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