问题已解决。 UserControl函数关闭数据库连接。感谢
当我厌倦real_escape_string()
功能时,出现问题
致命错误:在...中的非对象上调用成员函数real_escape_string()
SqlClass:
class Sql {
protected $mysqli = '';
private $table = '';
private $where = '';
private $limit = '';
private $orderby = '';
private $data = '';
private $columns = '';
function __construct(){
try{
if(!$this->mysqli){
$this->mysqli = new mysqli(VTConnectIP, VTConnectRoot, VTConnectPass, VTConnectDB)
or die(mysqli_connect_error());
$this->tr_fix_db();
}
return;
}catch(Exception $ex){
echo $ex->getMessage();
}
}
扩展课程:
class LoginClass extends Sql
{
private $username;
private $password;
private $email;
private $errors = array();
public function __construct(){
parent::__construct();
}
public function username($data){
$this->UserControl($data);
$this->username = $this->mysqli->real_escape_string($data); // Error Code
return $this;
}