没有这个的“开箱即用”的功能,但是,你应该能够建立这种没有很多的问题,
创建一个PHP类将提供所需的行为。 对不同数据库的连接数量没有限制。
创建读取功能,并写入功能。并确保所有应用程序I/O都运行此类。
类会是这个样子
class DB {
protected static $instance = null;
protected $master;
protected $slave;
public static function getInstance()
{
if (!isset(static::$instance)) {
static::$instance = new static;
}
return static::$instance;
}
public __construct(){
// init master and slave connection
}
public read($sql){
// read slave
// if not exists read master
}
public write($sql){
// write to master
}
}
?>
希望这将让你对你的方式