mysql_real_escape_string()在MySQL中留下斜线 [英] mysql_real_escape_string() leaving slashes in MySQL

查看:84
本文介绍了mysql_real_escape_string()在MySQL中留下斜线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚搬到一家新的托管公司,现在每当使用以下方法转义字符串时,

I just moved to a new hosting company and now whenever a string gets escaped using:

mysql_real_escape_string($str);

斜杠保留在数据库中.这是我第一次看到这种情况,所以我的脚本都没有使用

the slashes remain in the database. This is the first time I've ever seen this happen so none of my scripts use

stripslashes()

了.

这是在lighttpd 1.4服务器上以fastcgi运行php 5.2.6的CentOS 4.5 64位上.我确保所有magic_quotes选项均已关闭,并且mysql客户端api为5.0.51a.

This is on a CentOS 4.5 64bit running php 5.2.6 as fastcgi on a lighttpd 1.4 server. I've ensured that all magic_quotes options are off and the mysql client api is 5.0.51a.

我的所有6台网络服务器上都存在相同的问题.

I have the same issue on all 6 of my webservers.

任何帮助将不胜感激.

谢谢.

推荐答案

您移动的主机可能已打开magic_quotes_runtime.您可以使用set_magic_quotes_runtime(0)将其关闭.

The host that you've moved probably has magic_quotes_runtime turned on. You can turn it off with set_magic_quotes_runtime(0).

请关闭magic_quotes_runtime,然后将代码更改为使用绑定变量,而不是使用字符串转义.

Please turn off magic_quotes_runtime, and then change your code to use bind variables, rather than using the string escaping.

这篇关于mysql_real_escape_string()在MySQL中留下斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆