如何防止数据库在引号中添加斜杠 [英] how to prevent database to add slash to quotes

查看:99
本文介绍了如何防止数据库在引号中添加斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这听起来确实很普遍,而且琐碎,但在这里遇到了挑战.我有一个Zend/Doctrine网站,我使用ckeditor进行后端管理.上传网站后,我意识到在进行编辑测试时,网站的外观和感觉混乱了.

i know this sounds really common and so trivial but , am having a challenge here. I have a web site with Zend/Doctrine and i use ckeditor for the backend management. after uploading the site i've realized that during edit testing the look and feel of the site is messed up.

借助firebug,我已经看到html上都有斜线.内联版后,外观恢复正常.文件太多,在从mysql输出数据之前,我想不出其他解码方法.

with the help of firebug, i've seen that there are slashes all over the html. after inline edition, the look and feel came back to normal. There are so many files , i can't think of doing other decoding before outputting data from mysql.

我必须使用哪些选项来解决此问题.该网站已经启动,对此我感到有些困惑.谁能给个提示吗?谢谢

What options do i have to solve this problem. the site is up already and i feel a bit unconfortable about this. Can anyone give a hint? thanks

推荐答案

我感谢每个人的帮助.确实接受的解决方案应该是@Stanislav Palatnik的解决方案.只是它不适用于我的.htaccess.托管服务器足够好,可以将php.ini放在我的public_html中,允许我对其进行更改.所以+1 @Stanislav Palatnik,因为他指出了这个问题.我还发现了一些我想分享的有趣信息,以防万一有人发现自己处于我的状况.

I thank every one for the help. Really the accepted solution should be the one from @Stanislav Palatnik . just that it didn't work with my .htaccess. the hosting server was nice enough to put a php.ini in my public_html allowing me to change it. So +1 to @Stanislav Palatnik because he pointed out the issue. i also found interesting information i thought i would share in case someone found himself in my situation.

info from: http://support.godaddy.com/groups/web-hosting/forum/topic/how-to-turn-off-magic_quotes_gpc/
Yes – the solution below worked for me:

(1) First of all do not try to turn off the magic quotes in your .htaccess file, it won’t work on godaddy.
(2) Second, if you’re running PHP5 on your account, rename your php.ini file to php5.ini, make sure it’s in your root folder.
(3) Third, make sure all the lines in your php5.ini file end in a semi colon ;
(4) Fourth, add this line to your php5.ini file:
magic_quotes_gpc = Off;

在同一页面上,有人说它不仅应该只是magic_quotes_gpc,还应该是其他的,如下所示:

on the same page someone said it shouldn't be only magic_quotes_gpc only but other ones aswell like shown below:

magic_quotes_gpc = Off;
magic_quotes_runtime = Off;
magic_quotes_sybase = Off;

希望这对某人有所帮助.特别感谢@Stanislav Palatnik

Hope this helped someone. Special thanks to @Stanislav Palatnik

这篇关于如何防止数据库在引号中添加斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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