我的php.ini文件里面的magic_quotes_gpc是打开的,
magic_quotes_gpc = On;另外magic_quotes_runtime = Off和magic_quotes_sybase = Off,
但是页面post传值的时候却不会自动转义。
纠结了,
真不知道怎么会出现这种事。
求过往的大神们指教。

解决方案 »

  1.   

    你的web环境是什么样的?还有你可以在程序端试试看看。
      

  2.   

    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
      

  3.   

    php5.0以下是受magic_quotes_gpc选项影响的,当magic_quotes_gpc选项为ON时,该数组中的元字符等内容就会做转义处理,为OFF时,用户的提交就会不做任何处理,直接送到数组中。
    http://blog.csdn.net/zhangjjjc/article/details/7248955
      

  4.   

    好吧,
    我承认,我的问题有问题,
    我的magic_quotes_gpc是打开的,
    而且,传递的值也是转义过了的,
    但是我在接受传值的页面使用
    echo "<script type=\"text/javascript\">window.alert('".$_POST['***']."');</script>";
    弹出框显示的传值是没经过转义的,
    不知道这是为什么。
    是我没搞清楚,
    对不起。