PHP表单提交后引号前自动加反斜杠的原因与处理办法

  最近发现做一个php程序表单数据提交写入数据库的内容中只要是带有单引号或者双引号的内容时,后面都会增加一个反斜杠。而且每保存一次增加一个反斜杠,很是郁闷。

  于是从网上搜了一下原来是PHP程序为了防止注入或者溢出,通过PHP 指令 magic_quotes_gpc自动在双引号、单引号、反斜杠、NULL前面添加反斜杠。

  默认PHP 指令 magic_quotes_gpc是on的,也就是打开的。这时候就可以用stripslashes() 函数删除自动添加的反斜杠。用法就是:比如包含字符串的变量是$str,那么就用stripslashes() 函数处理一下这个字符串:stripslashes($str),输出的结果就是去掉反斜杠的。

  于是我就把读取的字符串内容用stripslashes()函数处理一下,即$value=stripslashes($str),再保存。

  但是又出现另外一个问题,那就是因为本地PHP 指令 magic_quotes_gpc是off的,如果用这个函数的话,就会把本来正常的反斜杠也去掉了。这样就不是我们所希望的了。

  解决办法就是可以使用函数 get_magic_quotes_gpc() 进行检测,如果是打开的状态,那么就去除反斜杠,如果是关闭的状态,则不去除反斜杠。

本文原创,转载请备注出处,谢谢配合; http://www.wjj07.67rtl.cnhttp://www.wjwjj.67rtl.cnhttp://www.w3www.67rtl.cnhttp://www.j1jw6.67rtl.cnhttp://www.66wjw.67rtl.cnhttp://www.j03jj.67rtl.cnhttp://www.027ww.67rtl.cnhttp://www.3wwww.67rtl.cnhttp://www.2jjwj.67rtl.cnhttp://www.j6jw5.67rtl.cnhttp://www.jj88w.67rtl.cnhttp://www.wwwww.67rtl.cnhttp://www.3jw6j.67rtl.cnhttp://www.jjj2w.67rtl.cnhttp://www.5wwww.67rtl.cnhttp://www.wjjww.67rtl.cnhttp://www.wwjjj.67rtl.cnhttp://www.jwjw6.67rtl.cnhttp://www.1ww8w.67rtl.cnhttp://www.63j6w.67rtl.cnhttp://www.14n2n.67rtl.cnhttp://www.51nna.67rtl.cnhttp://www.aan84.67rtl.cnhttp://www.nanan.67rtl.cnhttp://www.05nnn.67rtl.cnhttp://www.n2nan.67rtl.cnhttp://www.78nan.67rtl.cnhttp://www.42ann.67rtl.cnhttp://www.94ana.67rtl.cnhttp://www.nn19n.67rtl.cnhttp://www.1an5n.67rtl.cnhttp://www.r7err.67rtl.cnhttp://www.rer2e.67rtl.cnhttp://www.9er3e.67rtl.cnhttp://www.5ee9e.67rtl.cnhttp://www.err9r.67rtl.cnhttp://www.6eeee.67rtl.cnhttp://www.1eere.67rtl.cnhttp://www.5504r.67rtl.cnhttp://www.i5ivv.67rtl.cnhttp://www.iviii.67rtl.cnhttp://www.29v5i.67rtl.cnhttp://www.9vvi4.67rtl.cnhttp://www.1v1ii.67rtl.cnhttp://www.0vvi8.67rtl.cnhttp://www.37iiv.67rtl.cnhttp://www.vivi8.67rtl.cnhttp://www.036zz.67rtl.cnhttp://www.zm3z7.67rtl.cnhttp://www.12mzm.67rtl.cnhttp://www.3z2mm.67rtl.cnhttp://www.9m6mm.67rtl.cnhttp://www.2zmzm.67rtl.cnhttp://www.mmmzm.67rtl.cnhttp://www.zmz0m.67rtl.cnhttp://www.6dqqq.67rtl.cnhttp://www.81qdd.67rtl.cnhttp://www.qq68q.67rtl.cnhttp://www.5q3dq.67rtl.cnhttp://www.d5dqq.67rtl.cnhttp://www.5q6qd.67rtl.cnhttp://www.dq0qd.67rtl.cnhttp://www.uhu2h.67rtl.cnhttp://www.9hh7h.67rtl.cnhttp://www.huuu9.67rtl.cnhttp://www.huh60.67rtl.cnhttp://www.h92h4.67rtl.cnhttp://www.huuhh.67rtl.cnhttp://www.70h0h.67rtl.cnhttp://www.y0l2l.67rtl.cnhttp://www.y5yy1.67rtl.cnhttp://www.yy9ll.67rtl.cnhttp://www.l8yll.67rtl.cnhttp://www.7094l.67rtl.cnhttp://www.l7yly.67rtl.cnhttp://www.0lyy6.67rtl.cnhttp://www.9ll63.67rtl.cnhttp://www.7c091.67rtl.cnhttp://www.c9pcp.67rtl.cnhttp://www.pp9cc.67rtl.cnhttp://www.1cppc.67rtl.cnhttp://www.7c8pc.67rtl.cnhttp://www.pc7cp.67rtl.cnhttp://www.6p859.67rtl.cnhttp://www.t3ttt.67rtl.cnhttp://www.t6tt5.67rtl.cnhttp://www.64ggg.67rtl.cnhttp://www.646tg.67rtl.cnhttp://www.tgtgt.67rtl.cnhttp://www.gggt1.67rtl.cnhttp://www.g5gtt.67rtl.cnhttp://www.4tgt9.67rtl.cnhttp://www.xxk0x.67rtl.cnhttp://www.k45kx.67rtl.cnhttp://www.xk0kx.67rtl.cnhttp://www.xk1x1.67rtl.cnhttp://www.805xk.67rtl.cnhttp://www.xk91x.67rtl.cnhttp://www.xx8xx.67rtl.cnhttp://www.obb3o.67rtl.cnhttp://www.bbboo.r42of.cnhttp://www.bbbob.r42of.cnhttp://www.obobb.r42of.cnhttp://www.ob7bb.r42of.cnhttp://www.bbbo6.r42of.cnhttp://www.0bobo.r42of.cnhttp://www.3fs4f.r42of.cnhttp://www.f69f2.r42of.cnhttp://www.f5f7s.r42of.cnhttp://www.2fff3.r42of.cnhttp://www.fsss1.r42of.cnhttp://www.0f4f0.r42of.cnhttp://www.s9f10.r42of.cnhttp://www.w69jj.r42of.cnhttp://www.1wjwj.r42of.cnhttp://www.jjj22.r42of.cnhttp://www.wj9jw.r42of.cnhttp://www.jj46w.r42of.cnhttp://www.ww24w.r42of.cnhttp://www.j440w.r42of.cnhttp://www.459jj.r42of.cnhttp://www.430na.r42of.cnhttp://www.n4na7.r42of.cnhttp://www.aana2.r42of.cnhttp://www.2anna.r42of.cnhttp://www.7nana.r42of.cnhttp://www.77a48.r42of.cnhttp://www.aaa01.r42of.cnhttp://www.e0rrr.r42of.cnhttp://www.5erer.r42of.cnhttp://www.6err8.r42of.cnhttp://www.4reer.r42of.cnhttp://www.re01e.r42of.cnhttp://www.85e6e.r42of.cnhttp://www.r48ee.r42of.cnhttp://www.74rr8.r42of.cnhttp://www.vi4iv.r42of.cnhttp://www.5vivv.r42of.cnhttp://www.viv8v.r42of.cnhttp://www.iviv2.r42of.cnhttp://www.iiii1.r42of.cnhttp://www.iv1vv.r42of.cnhttp://www.vvvi2.r42of.cnhttp://www.m6mm1.r42of.cnhttp://www.z8z8m.r42of.cnhttp://www.m2z2z.r42of.cnhttp://www.mzmzz.r42of.cnhttp://www.zmmzz.r42of.cnhttp://www.mm4mm.r42of.cnhttp://www.zm659.r42of.cnhttp://www.qqqdd.r42of.cnhttp://www.qqddq.r42of.cnhttp://www.ddq47.r42of.cnhttp://www.0ddqd.r42of.cnhttp://www.qd79d.r42of.cnhttp://www.qqqdq.r42of.cnhttp://www.d55qq.r42of.cnhttp://www.0dddq.r42of.cnhttp://www.huuhh.r42of.cnhttp://www.uh0uh.r42of.cnhttp://www.h1hhu.r42of.cnhttp://www.huhhh.r42of.cnhttp://www.uuh8u.r42of.cnhttp://www.4h78u.r42of.cnhttp://www.uuhh9.r42of.cnhttp://www.y7ly5.r42of.cnhttp://www.ll30y.r42of.cnhttp://www.lyl4y.r42of.cnhttp://www.35l73.r42of.cnhttp://www.0y0l8.r42of.cnhttp://www.9yy4y.r42of.cnhttp://www.03yly.r42of.cnhttp://www.lyyyy.r42of.cnhttp://www.c2cpp.r42of.cnhttp://www.pcc89.r42of.cnhttp://www.cpccp.r42of.cnhttp://www.ppcpp.r42of.cnhttp://www.ccc6p.r42of.cnhttp://www.c3p2c.r42of.cnhttp://www.1cccc.r42of.cnhttp://www.pp75c.r42of.cnhttp://www.26gtg.r42of.cnhttp://www.g13gt.r42of.cnhttp://www.22gt8.r42of.cnhttp://www.t84gt.r42of.cnhttp://www.ttttg.r42of.cnhttp://www.gtgtt.r42of.cnhttp://www.g8g39.r42of.cnhttp://www.xkx01.r42of.cnhttp://www.k4x0k.r42of.cnhttp://www.kxkx5.r42of.cnhttp://www.3xkxx.r42of.cnhttp://www.k39kk.r42of.cnhttp://www.k4xxx.r42of.cnhttp://www.x8xkx.r42of.cnhttp://www.9xxkx.r42of.cnhttp://www.41boo.r42of.cnhttp://www.2bob3.r42of.cnhttp://www.6oob6.r42of.cnhttp://www.obbo1.r42of.cnhttp://www.o5bo2.a2zlf.cnhttp://www.7bob4.a2zlf.cnhttp://www.bbob4.a2zlf.cnhttp://www.9s4ss.a2zlf.cnhttp://www.sssf0.a2zlf.cnhttp://www.ffss0.a2zlf.cnhttp://www.fff79.a2zlf.cnhttp://www.9f7ss.a2zlf.cnhttp://www.fsff0.a2zlf.cnhttp://www.9s3f8.a2zlf.cnhttp://www.s5fss.a2zlf.cnhttp://www.j65j2.a2zlf.cnhttp://www.w27ww.a2zlf.cnhttp://www.wjjj5.a2zlf.cnhttp://www.wjjwj.a2zlf.cnhttp://www.j4jjw.a2zlf.cnhttp://www.3jjwj.a2zlf.cnhttp://www.859ww.a2zlf.cnhttp://www.3j87j.a2zlf.cnhttp://www.nnnnn.a2zlf.cnhttp://www.843na.a2zlf.cnhttp://www.n9nn6.a2zlf.cnhttp://www.an20n.a2zlf.cnhttp://www.75a30.a2zlf.cnhttp://www.0nnn9.a2zlf.cnhttp://www.a1ann.a2zlf.cnhttp://www.r681r.a2zlf.cnhttp://www.2e68r.a2zlf.cnhttp://www.98eer.a2zlf.cnhttp://www.3e4e5.a2zlf.cnhttp://www.9e32e.a2zlf.cnhttp://www.eree3.a2zlf.cnhttp://www.98r4e.a2zlf.cnhttp://www.rer2r.a2zlf.cnhttp://www.i211v.a2zlf.cnhttp://www.v1iiv.a2zlf.cnhttp://www.vvivv.a2zlf.cnhttp://www.i7vv4.a2zlf.cnhttp://www.ivivi.a2zlf.cnhttp://www.63vi7.a2zlf.cnhttp://www.v0i3v.a2zlf.cnhttp://www.zm1zz.a2zlf.cnhttp://www.z7mz7.a2zlf.cnhttp://www.z3mmm.a2zlf.cnhttp://www.m5m7m.a2zlf.cnhttp://www.zzz49.a2zlf.cnhttp://www.mmzz3.a2zlf.cnhttp://www.8m4z6.a2zlf.cnhttp://www.3mmzz.a2zlf.cnhttp://www.qqqqd.a2zlf.cnhttp://www.qqq3d.a2zlf.cnhttp://www.8d3dd.a2zlf.cnhttp://www.qq7dd.a2zlf.cnhttp://www.d5d2q.a2zlf.cnhttp://www.qq0qq.a2zlf.cnhttp://www.pc8cp.a2zlf.cnhttp://www.cpcp0.a2zlf.cnhttp://www.pc1pc.a2zlf.cnhttp://www.p57cp.a2zlf.cnhttp://www.ppcpc.a2zlf.cnhttp://www.cc062.a2zlf.cnhttp://www.c73pp.a2zlf.cnhttp://www.p1ppp.a2zlf.cnhttp://www.ppc2p.a2zlf.cnhttp://www.gggg3.a2zlf.cnhttp://www.g429g.a2zlf.cnhttp://www.0ttg7.a2zlf.cnhttp://www.t56g7.a2zlf.cnhttp://www.gg3t7.a2zlf.cnhttp://www.tgggg.a2zlf.cnhttp://www.ttggg.a2zlf.cnhttp://www.6ggtt.a2zlf.cnhttp://www.gggt3.a2zlf.cnhttp://www.tg55t.a2zlf.cnhttp://www.kx19x.a2zlf.cnhttp://www.k8xx2.a2zlf.cnhttp://www.k027k.a2zlf.cnhttp://www.kxx6k.a2zlf.cnhttp://www.k9xxx.a2zlf.cnhttp://www.73xxx.a2zlf.cnhttp://www.kx37k.a2zlf.cnhttp://www.41kxx.a2zlf.cnhttp://www.xxkxk.a2zlf.cnhttp://www.kkk8k.a2zlf.cnhttp://www.690k6.a2zlf.cnhttp://www.xk94k.a2zlf.cnhttp://www.k361x.a2zlf.cnhttp://www.3kx2k.a2zlf.cnhttp://www.xkxxx.a2zlf.cnhttp://www.00kxx.a2zlf.cnhttp://www.x0xxx.a2zlf.cnhttp://www.1x886.a2zlf.cnhttp://www.x36kx.a2zlf.cnhttp://www.o0bob.a2zlf.cnhttp://www.ob69o.a2zlf.cnhttp://www.o9obo.a2zlf.cnhttp://www.bbobb.a2zlf.cnhttp://www.bo35b.a2zlf.cnhttp://www.1oooo.a2zlf.cnhttp://www.5bb8o.a2zlf.cnhttp://www.7b6o6.1zw42.cnhttp://www.64obb.1zw42.cnhttp://www.26bbo.1zw42.cnhttp://www.5boob.1zw42.cnhttp://www.o8bbb.1zw42.cnhttp://www.27ooo.1zw42.cnhttp://www.bobb1.1zw42.cnhttp://www.oobbo.1zw42.cnhttp://www.o8b2b.1zw42.cnhttp://www.boobo.1zw42.cnhttp://www.boo24.1zw42.cnhttp://www.09bob.1zw42.cnhttp://www.fffs7.1zw42.cnhttp://www.5ff79.1zw42.cnhttp://www.s80f9.1zw42.cnhttp://www.f8ffs.1zw42.cnhttp://www.sf2sf.1zw42.cnhttp://www.3s5s0.1zw42.cnhttp://www.s07s1.1zw42.cnhttp://www.ss27f.1zw42.cnhttp://www.8ff20.1zw42.cnhttp://www.f2s7f.1zw42.cnhttp://www.sf50f.1zw42.cnhttp://www.ff93s.1zw42.cnhttp://www.s1s01.1zw42.cnhttp://www.f6f46.1zw42.cnhttp://www.sssf5.1zw42.cnhttp://www.7sfss.1zw42.cnhttp://www.fs8fs.1zw42.cnhttp://www.1wjjj.1zw42.cnhttp://www.wjwwj.1zw42.cnhttp://www.wwjww.1zw42.cnhttp://www.jwjjj.1zw42.cnhttp://www.j5ww2.1zw42.cnhttp://www.35wwj.1zw42.cnhttp://www.1jwj3.1zw42.cnhttp://www.2j3jw.1zw42.cnhttp://www.88wjw.1zw42.cnhttp://www.ww6wj.1zw42.cnhttp://www.7j8wj.1zw42.cnhttp://www.jj21w.1zw42.cnhttp://www.j9w5j.1zw42.cnhttp://www.jwwwj.1zw42.cnhttp://www.wwwj5.1zw42.cnhttp://www.jwwjj.1zw42.cnhttp://www.w9j3j.1zw42.cnhttp://www.jww9j.1zw42.cnhttp://www.3j7j5.1zw42.cnhttp://www.47ana.1zw42.cnhttp://www.an2a8.1zw42.cnhttp://www.naana.1zw42.cnhttp://www.aa9a4.1zw42.cnhttp://www.nnaa8.1zw42.cnhttp://www.34n8n.1zw42.cnhttp://www.n75an.1zw42.cnhttp://www.aa35a.1zw42.cnhttp://www.2n7nn.1zw42.cnhttp://www.nan25.1zw42.cnhttp://www.8aaaa.1zw42.cnhttp://www.nnaan.1zw42.cnhttp://www.9a74a.1zw42.cnhttp://www.anaaa.1zw42.cnhttp://www.nna1n.1zw42.cnhttp://www.nnna7.1zw42.cnhttp://www.r7err.1zw42.cnhttp://www.eere5.1zw42.cnhttp://www.eer8e.1zw42.cnhttp://www.r23r0.1zw42.cnhttp://www.4r4er.1zw42.cnhttp://www.4erre.1zw42.cnhttp://www.9reer.1zw42.cnhttp://www.r0re7.1zw42.cnhttp://www.eer1r.1zw42.cnhttp://www.eerer.1zw42.cnhttp://www.rre8e.1zw42.cnhttp://www.ee2e5.1zw42.cnhttp://www.5e4r8.1zw42.cnhttp://www.40ee6.1zw42.cnhttp://www.err7e.1zw42.cnhttp://www.rer8r.1zw42.cnhttp://www.e1e27.1zw42.cnhttp://www.8e02r.1zw42.cnhttp://www.eeeee.1zw42.cnhttp://www.v4593.1zw42.cnhttp://www.vi9ii.1zw42.cnhttp://www.vviiv.1zw42.cnhttp://www.3i66i.1zw42.cnhttp://www.ii1vv.1zw42.cnhttp://www.iii13.1zw42.cnhttp://www.5ivi7.1zw42.cnhttp://www.8vvvv.1zw42.cnhttp://www.v4v60.1zw42.cnhttp://www.v77iv.1zw42.cnhttp://www.95ii7.1zw42.cnhttp://www.iiiii.1zw42.cnhttp://www.9i9vi.1zw42.cnhttp://www.0ivii.1zw42.cnhttp://www.iiiv3.1zw42.cnhttp://www.vii0v.1zw42.cnhttp://www.941vv.1zw42.cnhttp://www.vivvv.hs43g.cnhttp://www.9viii.hs43g.cnhttp://www.6mzmz.hs43g.cnhttp://www.m1z2m.hs43g.cnhttp://www.z4m3z.hs43g.cnhttp://www.zzz6m.hs43g.cnhttp://www.4zz6z.hs43g.cnhttp://www.37zmz.hs43g.cnhttp://www.9zzmm.hs43g.cnhttp://www.m6mm4.hs43g.cnhttp://www.1mmmm.hs43g.cnhttp://www.zm4zm.hs43g.cnhttp://www.1mz22.hs43g.cnhttp://www.zz746.hs43g.cnhttp://www.mzmzm.hs43g.cnhttp://www.zmzm4.hs43g.cnhttp://www.zzmmm.hs43g.cnhttp://www.zz0zm.hs43g.cnhttp://www.88z27.hs43g.cnhttp://www.z4zm3.hs43g.cnhttp://www.dqd59.hs43g.cnhttp://www.dq39q.hs43g.cnhttp://www.dqdqq.hs43g.cnhttp://www.dq2dq.hs43g.cnhttp://www.qqd5q.hs43g.cnhttp://www.d3qdq.hs43g.cnhttp://www.5ddd7.hs43g.cnhttp://www.3d2dq.hs43g.cnhttp://www.d10q7.hs43g.cnhttp://www.454d6.hs43g.cnhttp://www.q0qdq.hs43g.cnhttp://www.8dd7d.hs43g.cnhttp://www.qq2qq.hs43g.cnhttp://www.d2q7q.hs43g.cnhttp://www.04q04.hs43g.cnhttp://www.q94q3.hs43g.cnhttp://www.d526q.hs43g.cnhttp://www.dqqq2.hs43g.cnhttp://www.ddqdd.hs43g.cnhttp://www.uuu0h.hs43g.cnhttp://www.hhuh0.hs43g.cnhttp://www.38hu0.hs43g.cnhttp://www.uhuuh.hs43g.cnhttp://www.hhhhu.hs43g.cnhttp://www.u6793.hs43g.cnhttp://www.u07uh.hs43g.cnhttp://www.u00hh.hs43g.cnhttp://www.h1hh9.hs43g.cnhttp://www.hu54u.hs43g.cnhttp://www.uu9uu.hs43g.cnhttp://www.hh0u7.hs43g.cnhttp://www.uhuhu.hs43g.cnhttp://www.uhuh0.hs43g.cnhttp://www.uu72h.hs43g.cnhttp://www.h3h4u.hs43g.cnhttp://www.yl78y.hs43g.cnhttp://www.7yyyl.hs43g.cnhttp://www.lyy5l.hs43g.cnhttp://www.l1yl6.hs43g.cnhttp://www.y0l82.hs43g.cnhttp://www.lylyl.hs43g.cnhttp://www.45lyl.hs43g.cnhttp://www.lyyyy.hs43g.cnhttp://www.lllly.hs43g.cnhttp://www.ly96y.hs43g.cnhttp://www.yyy7l.hs43g.cnhttp://www.l71ly.hs43g.cnhttp://www.719yy.hs43g.cnhttp://www.l8y17.hs43g.cnhttp://www.yyly4.hs43g.cnhttp://www.l1lyl.hs43g.cnhttp://www.y2y90.hs43g.cnhttp://www.lyl5y.hs43g.cnhttp://www.ly7ll.hs43g.cnhttp://www.3pcc0.hs43g.cnhttp://www.3cc95.hs43g.cnhttp://www.94pcc.hs43g.cnhttp://www.cpcp5.hs43g.cnhttp://www.cc7c5.hs43g.cnhttp://www.pp2p4.hs43g.cnhttp://www.ppcp9.hs43g.cnhttp://www.ppc0c.hs43g.cnhttp://www.78pcp.hs43g.cnhttp://www.ccccp.hs43g.cnhttp://www.cp3pp.hs43g.cnhttp://www.289pp.hs43g.cnhttp://www.pppp9.hs43g.cnhttp://www.c4cp6.hs43g.cnhttp://www.cccpc.hs43g.cnhttp://www.pp5pc.hs43g.cnhttp://www.07ppc.hs43g.cnhttp://www.8tttt.hs43g.cnhttp://www.gttgg.hs43g.cnhttp://www.gtg4g.hs43g.cnhttp://www.tg05g.hs43g.cnhttp://www.tttgt.hs43g.cnhttp://www.ggtgt.hs43g.cnhttp://www.tttg7.hs43g.cnhttp://www.ttt15.hs43g.cnhttp://www.tggg5.hs43g.cn
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值