有人知道为什么 mysql_real_escape_string() 函数在引号或双引号前添加三个反斜杠,而不是一个吗?
我在检索内容时遇到问题;有一个额外的反斜杠。这仅发生在 Aruba MySQL 服务器上。在本地主机上效果很好。
这可能是特定的排序规则吗?我能为此做些什么? (除了暴力删除斜线?)
最佳答案
您的问题可能是 magic_quotes_gpc
已启用:
It is best to look at your PHP configuration file (php.ini) and make sure it is disabled:
magic_quotes_gpc = Off
if you turn it on and you use mysql_real_escape_string, then you end up double escaping your quotes which is NOT good.
http://www.php-developer.org/best-practices-of-mysql_real_escape_string-function-in-php/
关于php - 逃离 MySQL PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11105989/