本文整理汇总了PHP中Zend::_registry方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend::_registry方法的具体用法?PHP Zend::_registry怎么用?PHP Zend::_registry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend
的用法示例。
在下文中一共展示了Zend::_registry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __unsetRegistry
/**
* primarily for tearDown() in unit tests
*/
public static function __unsetRegistry()
{
self::$_registry = null;
}
示例2: initRegistry
/**
* Initialize the registry. Invoking this method more than once will generate an exception.
*
* @param mixed $registry - Either a name of the registry class (Zend_Registry, or a subclass)
* or an instance of Zend_Registry (or subclass)
*
* @return Zend_Registry
*/
public static function initRegistry($registry = 'Zend_Registry')
{
// prevent multiple calls to this method
if (self::$_registry !== null) {
throw new Zend_Exception(__CLASS__ . '::' . __FUNCTION__ . '()' . '::' . __LINE__ . ' registry already initialized.');
}
if ($registry === 'Zend_Registry') {
require_once 'Zend/Registry.php';
}
if (is_string($registry)) {
if (!class_exists($registry, false)) {
throw new Zend_Exception(__CLASS__ . '::' . __FUNCTION__ . '()' . '::' . __LINE__ . " {$registry}' class not found.");
} else {
self::initRegistry(new $registry());
}
} else {
if (!class_exists('Zend_Registry', false)) {
require_once 'Zend/Registry.php';
}
if (!$registry instanceof Zend_Registry) {
throw new Zend_Exception(__CLASS__ . '::' . __FUNCTION__ . '()' . '::' . __LINE__ . " {$registry}' is not an \"" . "instanceof\" Zend_Registry (or subclass)");
}
self::$_registry = $registry;
}
return self::$_registry;
}