PHP 8.4.26 Released!

Yaf_Loader::__construct

(Yaf >=1.0.0)

Yaf_Loader::__construct — The constructor is private

Açıklama

private function Yaf_Loader::__construct()

Constructs a new loader. The constructor is private; Yaf_Loader is a singleton. Use Yaf_Loader::getInstance() to obtain the instance.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

No value is returned.

Örnekler

Örnek 1 Obtaining the Yaf_Loader singleton

<?php
$app = new Yaf_Application(__DIR__ . "/conf/application.ini");

/* the constructor is private; use getInstance() instead */
$loader = Yaf_Loader::getInstance();
var_dump($loader instanceof Yaf_Loader);

/* instantiating directly raises an Error */
try {
    $loader = new Yaf_Loader();
} catch (Error $e) {
    echo $e->getMessage(), PHP_EOL;
}
?>

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

bool(true)
Call to private Yaf_Loader::__construct() from global scope

Ayrıca Bakınız

+add a note

User Contributed Notes

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