新建Db.php 内容如下
class Db {
public $conn;
private $where = '';
private $limit = '';
private $order = '';
public static $sql = null;
private $localhost = null;
private $username = null;
private $password = null;
private $database = null;
private $prefix = null;
private $charset = null;
public function __construct() {
require_once ('Conf.php');
$this->localhost = $conf['localhost'];
$this->username = $conf['username'];
$this->password = $conf['password'];
$this->database = $conf['database'];
$this->prefix = $conf['prefix'];
$this->charset = $conf['charset'];
$this->conn = mysqli_connect($this->localhost, $this->username, $this->password);
mysqli_select_db($this->conn, $this->database);
mysqli_query($this->conn, 'set names ' . $this->charset);
}
}