Home  >  Q&A  >  body text

This error occurs when inheriting the abstract class aDB. If you do not inherit, no error will be reported.

<?php


abstract class aDB{


/*

* Connect to the database and read configuration information from the configuration file

*/

abstract public function conn();


abstract public function query ();


// abstract public function getAll();




##}



##class Mysql extends aDB{



public $link;


/*

*Connect to the database and read from the configuration file Configuration information

*/

public function conn(){

include 'config.php';

$this->link = new mysqli ($cfg['host'], $cfg['user'], $cfg['pwd'], $cfg['db']);

var_dump($this->link);

}


public function query($sql){

return $this->link- >query($sql);

}

## // public function getAll($sql){

// $res = $this->query($sql);

// var_dump($res);

// }


}

$mysql = new Mysql();

$mysql->conn();

?>

LL1997 days ago1127

reply all(1)I'll reply

  • L

    L2019-05-26 02:22:15

    Solved, solved, the abstract method does not give parameters, it is too careless

    reply
    0
  • Cancelreply