Inc*_*ito 4 php apache get http mysql-real-escape-string
我真的很困惑,有人可以向我解释一下吗?
请求:
http://example.com/test.php?var=String's
$a = $_GET["var"];
$b = "String's";
echo $a . "<br/>";
echo $b . "<br/>";
$output = mysql_real_escape_string($a);
$output = mysql_real_escape_string($b);
echo "<hr/>";
echo $a . "<br/>";
echo $b . "<br/>";
Run Code Online (Sandbox Code Playgroud)
结果:
String\'s
String's
----------------
String\'s
String's
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么我的GET变量正在被这样转换,但是我如何能够删除这种行为,使得我的输入与发送完全一样?我有一个问题,我的SQL包装器通过mysql_real_escape_string()传递它,最终是String\\\'s:(