本帖最后由 ilovejr 于 2010-04-02 14:29:10 编辑

解决方案 »

  1.   

    好好看看手册magic_quotes_gpc boolean
    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. 注: 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

    If magic_quotes_runtime is enabled, most functions that return data from any sort of external source including databases and text files will have quotes escaped with a backslash. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash.=====================================================
    magic_quotes_gpc :为$_GET,$_POST,$_COOKIE数据转义
    magic_quotes_runtime : 为从文件/数据库读取的内容进行转义
      

  2.   

    谢谢楼上,我用php_flag magic_quotes_gpc Off
    把它关了,
      

  3.   

    楼主可通过一下代码关闭magic_quotes
    <?php 
    if (get_magic_quotes_gpc()) {
        function stripslashes_deep($value)
        {
            $value = is_array($value)? array_map('stripslashes_deep', $value) : stripslashes($value);
            return $value;
        }    $_POST = array_map('stripslashes_deep', $_POST);
        $_GET = array_map('stripslashes_deep', $_GET);
        $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    }
    ?>
      

  4.   

    官方在手册里已经说明了,在运行时是关不了的,也就是通过PHP代码是无能为力了
      

  5.   

    magic_quotes 开启的本质是对字符串进行addslashes操作 php中进行相反的操作 stripslashes就等于关闭了magic_quotes 楼主不妨把配置文件的magic_quotes_gpc 改为on 再试试这个函数