$str = 'BEGIN This is a "quote" test. \'Single\' END';
echo $str . "\n";
echo mysql_real_escape_string($str);
// Outputs:
BEGIN This is a "quote" test. 'Single' END
BEGIN This is a \"quote\" test. \'Single\' END在CentOS上运行PHP5.3.2。据我所知,mysql_real_escape_string()只会转义单引号以防止注入。双引号与此无关,因为"不会在MySQL中开始或结束字符串文字!
这会导致在数据中插入反斜杠!一些我显然不想要的东西。
发布于 2010-08-26 22:14:54
发布于 2010-08-26 23:56:08
听起来像是魔术引语被打开了。
这篇文章详细描述了你的问题,以及修复方法。http://www.sitepoint.com/forums/showthread.php?t=545824
https://stackoverflow.com/questions/3575969
复制相似问题