Home > Q&A > body text
1
2
3
4
5
6
<?php
set_magic_quotes_runtime(false);
ini_set('magic_quotes_gpc',0);
ini_set
(
'magic_quotes_gpc'
,0);
ini_set('magic_quotes_runtime',0);
'magic_quotes_runtime'
echo $_GET['a'];
echo
$_GET
[
'a'
];
这样。访问a.php?a=1'\ 输出的还是l\'\\
怎么能自动关闭?
不使用stripslashes
迷茫2017-04-10 14:28:02
7
8
9
10
11
12
if (get_magic_quotes_gpc()) {
if
(get_magic_quotes_gpc()) {
function stripslashes_deep($value)
function
stripslashes_deep(
$value
)
{
$value = is_array($value) ?
=
is_array
) ?
array_map(’stripslashes_deep’, $value) :
array_map
(’stripslashes_deep’,
) :
stripslashes($value);
stripslashes
);
return $value;
return
;
}
$_POST = array_map(’stripslashes_deep’, $_POST);
$_POST
$_GET = array_map(’stripslashes_deep’, $_GET);
$_COOKIE = array_map(’stripslashes_deep’, $_COOKIE);
$_COOKIE