Home >Backend Development >PHP Tutorial >php怎么关闭自动过滤输入和输出

php怎么关闭自动过滤输入和输出

WBOY
WBOYOriginal
2016-06-06 20:50:321500browse

<?php set_magic_quotes_runtime(false);
ini_set('magic_quotes_gpc',0);
ini_set('magic_quotes_runtime',0);

echo $_GET['a'];

这样。访问a.php?a=1'\
输出的还是l\'\\

怎么能自动关闭?

不使用stripslashes

回复内容:

<?php set_magic_quotes_runtime(false);
ini_set('magic_quotes_gpc',0);
ini_set('magic_quotes_runtime',0);

echo $_GET['a'];

这样。访问a.php?a=1'\
输出的还是l\'\\

怎么能自动关闭?

不使用stripslashes

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);
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn