PHP 8.4.26 Released!

Yaf_Config_Ini::__construct

(Yaf >=1.0.0)

Yaf_Config_Ini::__construct — Constructor of Yaf_Config_Ini

Açıklama

publicfunction Yaf_Config_Ini::__construct(mixed $config_file, string $section = NULL)

Creates a new Yaf_Config_Ini instance from an INI file or an array. The resulting configuration is always read-only.

Bağımsız Değişkenler

config_file

The path to an INI file, or an array of configuration values.

section

The INI section name to load. If omitted, all sections are loaded.

Dönen Değerler

No value is returned.

Örnekler

Örnek 1 Yaf_Config_Ini::__construct() example

<?php
/**
 * Assume /etc/myapp/application.ini contains:
 * [common]
 * application.name = "MyApp"
 * database.host    = "localhost"
 * database.port    = 3306
 *
 * [production : common]
 * log.level        = "warning"
 */

// Load only the "production" section, which inherits from "common"
$config = new Yaf_Config_Ini('/etc/myapp/application.ini', 'production');

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

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

MyApp
localhost
warning

Ayrıca Bakınız

+add a note

User Contributed Notes

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