我有两个对象:
1.
$mysqli = @new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
这var_dump
是:
object(mysqli)#6 (0) {
}
2.
$conn = new Classes_dbFactory("MySQLi", DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
这个 mysqli 连接var_dump
的包装器为:
object(Classes_dbFactory)#7 (1) {
["_connection:protected"]=>
object(mysqli)#8 (0) {
}
}
如果我这样做:
$city = $mysqli->real_escape_string($city);
有用。但是,如果我这样做:
$city = $conn->real_escape_string($city);
我明白了Call to undefined method Classes_dbFactory::real_escape_string()
有没有办法使用object(mysqli)
里面的 whichobject(Classes_dbFactory)
以便可以使用现有的本机 mysqli 方法?