修正当使用table方法的时候 getPk方法的BUG

This commit is contained in:
thinkphp
2016-02-01 12:19:31 +08:00
parent 051aa149b0
commit d381c51892

View File

@@ -1102,7 +1102,8 @@ class Model
public function getPk()
{
if (is_null($this->pk)) {
$this->pk = $this->getTableInfo('', 'pk');
$tableName = isset($this->options['table']) ? $this->options['table'] : $this->getTableName();
$this->pk = $this->getTableInfo($tableName, 'pk');
}
return $this->pk;
}