PHP 8.6.0 Beta 3 is available for testing

Yaf_Registry::set

(Yaf >=1.0.0)

Yaf_Registry::setAdd an item into registry

Açıklama

public static function Yaf_Registry::set(string $name, mixed $value): bool

Stores a value in the registry. Setting an already existing name overwrites its previous value.

Bağımsız Değişkenler

name

The name of the registry entry.

value

The value to store; it may be of any type, including objects.

Dönen Değerler

Returns true on success, or false on failure.

Örnekler

Örnek 1 Yaf_Registry::set() example

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
    public function _initRedis(Yaf_Dispatcher $dispatcher)
    {
        $config = Yaf_Application::app()->getConfig()->redis;

        $redis = new Redis();
        $redis->connect($config->host, $config->port);

        /* the connection is now available to the whole application */
        Yaf_Registry::set("redis", $redis);
    }
}
?>

Ayrıca Bakınız

add a note

User Contributed Notes

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