我实际上是在寻找mysql_real_escape_string的替代品 解决这个错误。 在PHP 5.4它完美但不再在PHP 5.5
$this->mysqli = new mysqli($this->host, $this->user, $this->pass, $this->name);
// in class user
public function __set($p_sProperty, $p_vValue)
{
switch($p_sProperty)
{
// this is marked as the error
case "Email":
$this->Email = **mysql_real_escape_string**($p_vValue);
break;
}
}
答案 0 :(得分:11)
您使用MySQLi,请使用mysqli_real_escape_string()
:
$this->Email = $this->mysqli->real_escape_string($p_vValue);