我想知道 Zend_Registry 是否使用 phpMemory、 session 或其他方法。
这个问题更多的是我的好奇。
Zend_Registry::set('test', array());
最佳答案
Zend_Registry 是对存储数组的 static
类型变量的包装器。
来自维基百科的静态变量定义
In computer programming, a static variable is a variable that has been allocated statically — whose lifetime extends across the entire run of the program.
存储在 Zend_Registry 中的类似变量扩展到整个程序运行。
一个简单的 My Registry 类
class My_Registry
{
static $storage;
public static function set($key,$value)
{
self::$storage[$key] = $value;
}
public static function get($key)
{
return self::$storage[$key];
}
}
关于zend-framework - Zend Registry 是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10209389/