class mysql{
function __construct(){
$this->connect();
}
function __destruct(){
$mysqli = $this->connect();
$mysqli->close();
}
public function connect(){
static $mysqli;
require_once(ROOT_PATH.'/config/db_conf.php');
@$mysqli = new mysqli($sql_login['host'], $sql_login['user'], $sql_login['password'] , $sql_login['database'], $sql_login['port']);
if(!$mysqli){
throw new Exception("Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error);
}
return $mysqli;
}
}
当我尝试连接到 mysql - 一切都很好,但之后我收到警告:mysqli::close(): Couldn't fetch mysqli in...