php代码:
<?php
//mysqli的DB 类
/**
*
*/
class MYSQLI{
public $dbhost; //主机
public $dbuser; //用户
public $dbpassword; //密码
public $dbname; //数据库名称
public $dbport; //端口号
public $errno; //错误号
public $error; //错误内容
public $mysqli; //mysqli连接对象句柄
public $query; //query结果
public $result; //查询的结果集
public $aff_rows; //受影响的行数
public $num_rows; //查询结果条数
function __construct(){
//连接数据库
$this->mysqli = new mysqli($this->dbhost, $this->dbuser, $this->dbpassword, $this->dbname, $this->dbport);
if($this->mysqli->connect_error){
die('Connect Error ('.$this->mysqli->connect_errno.')'.$this->mysqli->connect_error);
}
}
//执行 dml 操作语句
function dml($sql){
$this->query = $this->mysqli->query($sql);
}
//取得受影响的行数
function affected_rows(){
$this->aff_rows = $this->mysqli->affected_rows;
}
//执行 dql 语句
function dql($sql){
$this->result = $this->mysqli->query($sql);
}
//取得查询结果条数
function num_rows(){
$this->num_rows = $this->result->num_rows;
}
//取得查询结果集
function fetch_object(){
//以对象形式返回
return $obj = $this->result->fetch_object();
}
}
?>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号