mysql_real_escape_string() leaving slashes in MySQL

前端 未结 9 1080
囚心锁ツ
囚心锁ツ 2020-12-16 16:41

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

9条回答
  •  一整个雨季
    2020-12-16 17:08

    You must probably have magic quotes turned on. Figuring out exactly how to turn it off can be quite a headache in PHP. While you can turn off magic quotes with set_magic_quotes_runtime(0), it isn't enough -- Magic quotes has already altered the input data at this point, so you must undo the change. Try with this snippet: http://talks.php.net/show/php-best-practices/26

    Or better yet -- Disable magic quotes in php.ini, and any .htaccess files it may be set in.

提交回复
热议问题