我想以一种安全但通用的方式在 PHP 代码中使用字符串变量,例如下面的示例。我见过 htmlspecialchars() 但我认为这不是我能得到的最好的。并且 mysql 函数绝对不是解决方案(无论如何,不推荐使用 mysql_real_escape_string 之类的东西)。
你们认为以下情况的最佳解决方案是什么:
$password = $_POST['password'];
$password_check = $_POST['password_check'];
//make $password and $password_check safe
if($password != $password_check)
{
$errors[] = 'The two passwords did not match';
}
谢谢