Home > Article > Backend Development > php addslashes uses recursion to use backslashes to quote strings_PHP tutorial
Implementation code:
//Test data
$_POST['STR'] = "'fanglor ' is a boy >'";
$_GET['STR1'] = 'fanglor " is a boy >' ;
echo 'The current get_magic_quotes_gpc is '.get_magic_quotes_gpc();
echo "
";
//Determine whether get_magic_quotes_gpc is currently enabled
if (!get_magic_quotes_gpc()){
$_POST = addslashes_deep($_POST);
$_GET = addslashes_deep($_GET);
$_COOKIE = addslashes_deep($_COOKIE);
}
//Print results
var_dump ($_POST);
echo "
";
var_dump ($_GET);
?>