当前位置: 首页 > 文档资料 > Yaf 用户手册 >

11.6. Yaf_Registry

优质
小牛编辑
115浏览
2023-12-01
简介

Yaf_Registry, 对象注册表(或称对象仓库)是一个用于在整个应用空间(application space)内存储对象和值的容器.通过把对象存储在其中,我们可以在整个项目的任何地方使用同一个对象.这种机制相当于一种全局存储. 我们可以通过Yaf_Registry类的静态方法来使用对象注册表.另外,由于该类是一个数组对象,你可以使用数组形式来访问其中的类方法.

在PHP5.3之后, 打开yaf.use_namespace的情况下, 也可以使用Yaf\Registry

 
  Yaf_Registry
{
public static Yaf_Registry 
 has
 ( string  $name );
public static Yaf_Registry 
 get
 ( string  $name );
public static Yaf_Registry 
 set
 ( string  $name ,
  mixed  $value );
public static Yaf_Registry 
 del
 ( string  $name );
}