更新时间:2022-12-31 15:14:56
只需创建2个数据库
类实例。
公共静态函数getInstance(){} $ c $的删除c>
不要这样:
Rid of, public static function getInstance(){}
Dont do like this:
$db = Database::getInstance();
相反:
$db1 = new Database();
$db2 = new Database();
将数据库
构造函数编辑为类似
public function __construct($dns, $username, $password){
$this->db = new PDO($dns,$username,$password);
}