设置了主从服务器后,支持从主服务器读数据

方法是在模型类中调用 readMaster方法
$this->readMaster()->select();

该方法当此调用有效
This commit is contained in:
thinkphp
2015-06-12 15:21:08 +08:00
parent 956be17494
commit cb9faf2aa9
2 changed files with 14 additions and 3 deletions

View File

@@ -1317,4 +1317,14 @@ class Model {
}
return $this;
}
/**
* 设置从主服务器读取数据
* @access public
* @return Model
*/
public function readMaster(){
$this->options['read_master'] = true;
return $this;
}
}