Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试清理变量并且遇到问题。
此代码正确输出回声:
$to_raw = $_POST['to'] ; echo $to_raw;
但这没有返回:
$to_raw = mysql_real_escape_string($_POST['to']) ; echo $to_raw;
我错过了什么吗?
如果您没有调用,该功能mysql_real_escape_string将不起作用mysql_connect。更好的解决方法是在顶部创建一个 MySQL 连接,然后再调用mysql_real_escape_string.
mysql_real_escape_string
mysql_connect
mysql_connect("localhost"); $to_raw = mysql_real_escape_string($_POST['to']) ; echo $to_raw;
与已弃用的函数相比,使用PDOor函数更好。mysqli_*mysql_*
PDO
mysqli_*
mysql_*