php stripslashes()和addslashes()用法_PHP教程

WBOY
Release: 2016-07-13 17:10:15
Original
995 people have browsed it

首先测试 magic_quotes_gpc 是否为 ON, 如果是,则用 array_map() 递归还原转义的数据,下面看用 stripslashes 还原 addslashes 转义后的数据 的简单实现代码

代码如下 复制代码

if(get_magic_quotes_gpc())
{
function stripslashes_deep($value)
{
$value = is_array($value) ? array_map('stripslashes_deep', $value) : (isset($value) ? stripslashes($value) : null);
return $value;
}

$_POST = stripslashes_deep($_POST);
$_GET = stripslashes_deep($_GET);
$_COOKIE = stripslashes_deep($_COOKIE);
}
?>

www.bkjia.com true http://www.bkjia.com/PHPjc/629684.html TechArticle 首先测试 magic_quotes_gpc 是否为 ON, 如果是,则用 array_map() 递归还原转义的数据,下面看用 stripslashes 还原 addslashes 转义后的数据 的简单实现...
Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!