Skip to content

Commit

Permalink
改进Model类
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Nov 11, 2016
1 parent af97ea5 commit fd30f09
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions library/think/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1365,19 +1365,10 @@ public function __call($method, $args)

public static function __callStatic($method, $params)
{
$query = self::getDb();
$query = (new static())->db();
return call_user_func_array([$query, $method], $params);
}

protected static function getDb()
{
$model = get_called_class();
if (!isset(self::$links[$model])) {
self::$links[$model] = (new static())->db();
}
return self::$links[$model];
}

/**
* 修改器 设置数据对象的值
* @access public
Expand Down

0 comments on commit fd30f09

Please sign in to comment.