Line 77 says that non-object calls the function fetch(). Can someone please explain it? I really can't find it.
远处一朵花
远处一朵花 2021-01-11 13:36:52
0
1
838

<?phpclass Db{ private $dbConfig=[                                                                                                                                                                                                                                                'port'=>'3306', 'user'=> 'root', 'pass'=>'root', 'charset'=>'utf8', 'dbname'=>'edu', ]; //Single case mode private static $instance = null; public $ insertID = null; public $num1 = null; ///Database connection private $conn = null; private function __construct($params) { //Initialization parameters array_merge($this->dbConfig, $params); //Connection The database $ this-& gt; connect ();} Private function __clone () {// todo: Implement __Clone () Method.} Public Static Function GetInstance ! Self :: $ Instance Instanceof Self ){ self::$instance = new self($params); } return self::$instance; } private function connect() { try { $dsn="{$this->dbConfig['d b']}: host={$this->dbConfig['host']};      port={$this->dbConfig['port']};dbname={$this->dbConfig['dbname']};        charset= {$this->dbConfig['charset']}";                                                                                                                                                                              ​ dbConfig['pass']); //// //// $this->conn->query("SET NAMES {$this->dbConfig['charset']}");CATCH (pdoexception $ E) {DIE ('database connection failed'. $ E-& GT; getMessage ());} public function exec ($ SQL) {$ NUM = $ this- & gt; conn-& gt; exce; C ($ sql); if($num>0) if(null !== $this->conn->lastInsertID()) { $this->insertID = $this->conn- >lastInsertID() ;                                     $this->num1= $num; ​​​​​print 'Operation failed '.$error[0].':'.$error[1].':'.$error[2];                                                                                                          ,                                    fetch($sql)                                                            . $sql)->fetch(PDO::FETCH_ASSOC); } public function fetchALl($sql) { return $this->conn->query($sql)->fetch(PDO::FETCH_ASSOC);; }}

远处一朵花
远处一朵花

reply all(1)
灭绝师太

The pdo object was not obtained successfully, and an object member method fetch was called to check the connection parameters.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template