PHP 8.6.0 Beta 3 is available for testing

Yaf_Registry::__construct

(Yaf >=1.0.0)

Yaf_Registry::__constructConstructor of Yaf_Registry

Açıklama

privatefunction Yaf_Registry::__construct()

The constructor is private: Yaf_Registry implements the singleton pattern and cannot be instantiated directly. Use the static methods to read and write registry entries.

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 Yaf_Registry::__construct() example

The constructor is private, so direct instantiation is rejected:

<?php
$registry = new Yaf_Registry();
?>

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

PHP Fatal error:  Uncaught Error: Call to private Yaf_Registry::__construct() from invalid context

Örnek 2 Using Yaf_Registry through its static methods

<?php
Yaf_Registry::set("version", Yaf_Application::app()->getConfig()->application->version);
var_dump(Yaf_Registry::get("version"));
?>

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

string(7) "1.0.0.1"

Ayrıca Bakınız

add a note

User Contributed Notes

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