PHP 8.4.26 Released!

Yaf_Registry::get

(Yaf >=1.0.0)

Yaf_Registry::get — Recupera un elemento del registro

Descripción

public static function Yaf_Registry::get(string $name): mixed

Recupera un elemento del registro.

Parámetros

name

El nombre de la entrada del registro.

Valores devueltos

El valor almacenado bajo name, o null si no existe ninguna entrada con ese nombre.

Ejemplos

Ejemplo #1 Ejemplo de Yaf_Registry::get()

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $redis = Yaf_Registry::get("redis");
        if ($redis === null) {
            throw new Exception("the redis connection is not registered");
        }

        $this->getView()->assign("visits", $redis->get("site:visits"));

        return true;
    }
}
?>

Véase también

+add a note

User Contributed Notes

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