内核更新

This commit is contained in:
2016-09-14 13:39:11 +08:00
parent d639c7d5f5
commit 3a6802216e
9 changed files with 136 additions and 43 deletions

View File

@@ -115,6 +115,8 @@ class Request
protected $filter;
// Hook扩展方法
protected static $hook = [];
// 绑定的属性
protected $bind = [];
/**
* 架构函数
@@ -1436,4 +1438,30 @@ class Request
Session::set($name, $token);
return $token;
}
/**
* 设置当前请求绑定的对象实例
* @access public
* @param string $name 绑定的对象标识
* @param mixed $obj 绑定的对象实例
* @return mixed
*/
public function bind($name, $obj = null)
{
if (is_array($name)) {
$this->bind = array_merge($this->bind, $name);
} else {
$this->bind[$name] = $obj;
}
}
public function __set($name, $value)
{
$this->bind[$name] = $value;
}
public function __get($name)
{
return isset($this->bind[$name]) ? $this->bind[$name] : null;
}
}