Maison >développement back-end >tutoriel php >php addslashes 利用递归实现使用反斜线引用字符串_PHP教程
实现代码:
//测试数据
$_POST['STR'] = "'fanglor ' is \ a boy >'";
$_GET['STR1'] = 'fanglor " is \ a boy >';
echo '当前get_magic_quotes_gpc为 '.get_magic_quotes_gpc();
echo "
";
//判断当前是否开启get_magic_quotes_gpc
if (!get_magic_quotes_gpc()){
$_POST = addslashes_deep($_POST);
$_GET = addslashes_deep($_GET);
$_COOKIE = addslashes_deep($_COOKIE);
}
//打印结果
var_dump ($_POST);
echo "
";
var_dump ($_GET);
?>