为什么所有 $_GET、$_POST 都会自动添加反斜杠?
我有一个带有 cPanel/Whm/CentOS 5.5 的 vps,问题是发送到我的服务器的所有参数都被 addslashed,我检查了 PHP 配置,发现所有魔术引号已关闭,我不知道是什么原因造成的。
我的代码非常干净,我知道它的每一点,而且我没有任何 addslashes()
或某种此类函数。我只想按原样接收参数。
URL: test.php?text=blah" ' " 'blah
<?php
echo $_GET["text"]; // Output blah\" \' \" \'blah
?>
怎么关掉这个东西?
谢谢
I have a vps with cPanel/Whm/CentOS 5.5 and the problem is that all parameters sent to my server are being addslashed, I've checked out the PHP configuration and i found out that all the magic quotes are turned off and i don't know what causes this.
My code is so clean and i know every bit of it and i don't have any addslashes()
or some sort of these functions. i only want to receive the parameters as they are.
URL: test.php?text=blah" ' " 'blah
<?php
echo $_GET["text"]; // Output blah\" \' \" \'blah
?>
How to turn off this thing?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是 php.ini 中的 magic_quotes_gpc 变量(这是第一个要打开的位置)关闭)。您应该真正检查一下您正在查看正确的文件。
我相信您也可以在 .htaccess 中或在运行时将其关闭。但是,如果您的主机不允许您执行其中任何一项操作,您可以使用以下函数,无论当前设置如何,该函数都会执行此操作。
It's the magic_quotes_gpc variable in your php.ini (this is the first place to turn it off). You should really check of you are looking at the right file.
You can also turn it off in .htaccess or at runtime I believe. But if your host doesn't won't let you do either of these things you can use the following function that will word regardless of the current setting.
您必须禁用 magic_quotes_gpc。
You have to disable magic_quotes_gpc.
这是一个(已弃用的)安全功能,称为“魔法引号”,并且可以把它关掉。
It's a (deprecated) security feature called "magic quotes," and it's possible to turn it off.