表单提交方法POST在引号前添加反斜杠(“to to”)

时间:2013-08-06 13:34:05

标签: php post

我刚刚将我的网站从一台服务器移动到另一台服务器,当我发现一个错误时,我正在测试该网站。问题是,在提交表单时,新服务器正在将字符串转换为hello"worldhello\"world

如何使用php防止这种情况或unescape字符?我不想使用正则表达式或其他东西来替换出现的情况,以防有时我真的需要在字符串中写\"


编辑 - 这是我的php.ini

的内容
; Rename this file to php.ini and uncomment or add directives.
; For a complete list of valid directives, visit:
;  http://us2.php.net/manual/en/ini.php

[PHP]
; We highly recommend that you leave this options enabled
cgi.fix_pathinfo=1
;open_basedir = "/home/172652/domains"

; Increase maximum post size
;post_max_size = 20M

; Increase execution time
;max_execution_time = 300

; pull in EGPCS [Environment, GET, POST, Cookie, Server] variables as globals
;register_globals = true

; For performance reasons, (mt) does not load all of the modules that are available
; into PHP. You may uncomment any one of the following "extension" lines to enable
; the desired module

; Salblotron XSLT
;extension=xslt.so

; save in local tmp
session.save_path=/home/172652/data/tmp

1 个答案:

答案 0 :(得分:7)

您已magic quotes已开启。

通过设置将PHP升级到最新版本(不再支持它们)或turn them off

magic_quotes_gpc = Off