zend-framework - Zend Registry 是如何工作的

标签 zend-framework

我想知道 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/

相关文章:

html - 如何在 Zend_Form 中为表格布局自定义错误输出

php - Zend_Db_Table 关系和 Zend_Paginator

zend-framework - Zend 后端 URL 发布

php - 如何在 zend framework 1 应用程序中使用 twitter bootstrap 框架?

php - 在深入研究框架(如 Zend、CakePHP)之前,您是否需要非常了解 PHP?

php - 如何使用 Bootstrap 修复菜单

zend-framework - Zend 分页 : How ot get arrray of data

php - 如何在 Zend Studio 10 中开发移动应用程序

php - Zend 框架 : How to give specific order to javascript files and scripts

php - 如何在 ZendFramework 中将图像作为 blob 插入 Db