in the 1.mvc framework, there is an error in the database operation class, and there is a file whose code is the same as mine. Why am I wrong?
  php 
 class MySQLPDO {
//
private $dbConfig = array(
        "db" => "MYSQL",
        "host" => "localhost",
        "port" => "3306",
        "user" => "root",
        "pass" => "root",
        "charset" => "utf8",
        "dbname" => "mvc_study",
    );
//
private static $instance;
//PDO
private $db;
//
private function __construct($params){
    $this->dbConfig = array_merge($this->dbConfig,$params);
    $this->connect();
}
//
public static function getInstance($params=array()){
    if(!self::$instance instanceof self){
        //new self()$params
        self::$instance = new self($params);
    }
    return self::$instance;
} 
//
private function __clone(){}
//
private function connect(){
    try{
        $dsn = "{$this->dbConfig["db"]}:port={$this->dbConfig["port"]};host={$this->dbConfig["host"]};dbname={$this->dbConfig["dbname"]};charset={$this->dbConfig["charset"]}";
        $pdo = new PDO($dsn,$this->dbConfig["user"],$this->dbConfig["pass"]);
        $pdo->query("set names {$this->dbConfig["charset"]}"); 
    }catch(PDOException $e){
        $e->getMessage();
    }
}
//sql
public function query($sql){
    return $this->db->query($sql);
}
//
public function fetchRow($sql){
    return $this->query($sql)->fetch(PDO::FETCH_ASSOC);
}
//
public function fetchAll($sql){
    return $this->query($sql)->fetchAll(PDO::FETCH_ASSOC);
}
}
? >
 
 
problem description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
