magic_quotes_gpc问题

eightwhells 2012-02-11 06:44:16
我的php.ini文件里面的magic_quotes_gpc是打开的,
magic_quotes_gpc = On;另外magic_quotes_runtime = Off和magic_quotes_sybase = Off,
但是页面post传值的时候却不会自动转义。
纠结了,
真不知道怎么会出现这种事。
求过往的大神们指教。
...全文
100 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
eightwhells 2012-02-13
  • 打赏
  • 举报
回复
好吧,
我承认,我的问题有问题,
我的magic_quotes_gpc是打开的,
而且,传递的值也是转义过了的,
但是我在接受传值的页面使用
echo "<script type=\"text/javascript\">window.alert('".$_POST['***']."');</script>";
弹出框显示的传值是没经过转义的,
不知道这是为什么。
是我没搞清楚,
对不起。
zhangjjjc 2012-02-13
  • 打赏
  • 举报
回复
php5.0以下是受magic_quotes_gpc选项影响的,当magic_quotes_gpc选项为ON时,该数组中的元字符等内容就会做转义处理,为OFF时,用户的提交就会不做任何处理,直接送到数组中。
http://blog.csdn.net/zhangjjjc/article/details/7248955
coder 2012-02-13
  • 打赏
  • 举报
回复
magic_quotes_gpc boolean
Warning
自 PHP 5.3.0 起,已经废弃此特性。强烈建议不要应用此特性 。

Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically.

Note:

In PHP 4, also $_ENV variables are escaped.

Note:

If the magic_quotes_sybase directive is also ON it will completely override magic_quotes_gpc. Having both directives enabled means only single quotes are escaped as ''. Double quotes, backslashes and NUL's will remain untouched and unescaped.

See also get_magic_quotes_gpc()

magic_quotes_runtime boolean
一起混吧 2012-02-13
  • 打赏
  • 举报
回复
修改后重启apache了吗
码无边 2012-02-13
  • 打赏
  • 举报
回复
你的web环境是什么样的?还有你可以在程序端试试看看。

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧