本文整理匯總了PHP中registry::grab方法的典型用法代碼示例。如果您正苦於以下問題:PHP registry::grab方法的具體用法?PHP registry::grab怎麽用?PHP registry::grab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類registry
的用法示例。
在下文中一共展示了registry::grab方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __get
public function __get($name)
{
if (isset($this->_class_index[$name])) {
$obj = registry::grab($this->_class_index[$name][0], $this->_class_index[$name][1]);
if ($obj) {
return $obj;
}
}
if (!$this->_shorts_loaded) {
$this->_shorts = static::__shortcuts();
$this->_shorts_loaded = true;
}
$obj = false;
if (isset($this->_shorts[$name])) {
if (is_array($this->_shorts[$name])) {
$obj = registry::register($this->_shorts[$name][0], $this->_shorts[$name][1]);
} else {
$obj = registry::register($this->_shorts[$name]);
}
} elseif (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
$obj = registry::register(registry::$aliases[$name][0], registry::$aliases[$name][1]);
} else {
$obj = registry::register(registry::$aliases[$name]);
}
} elseif (registry::class_exists($name)) {
$obj = registry::register($name);
}
if ($obj) {
$this->_class_index[$name] = array(get_class($obj), $obj->class_hash);
return $obj;
}
if ($const = registry::get_const($name)) {
return $const;
}
return null;
}