Home  >  Article  >  php教程  >  PHP5下$_SERVER变量不再受magic_quotes_gpc保护的弥补方法

PHP5下$_SERVER变量不再受magic_quotes_gpc保护的弥补方法

WBOY
WBOYOriginal
2016-06-13 11:57:041254browse

复制代码 代码如下:


$magic_quotes_gpc = get_magic_quotes_gpc();
@extract(daddslashes($_COOKIE));
@extract(daddslashes($_POST));
@extract(daddslashes($_GET));
if(!$magic_quotes_gpc) {
$_FILES = daddslashes($_FILES);
}


daddslashes函数

复制代码 代码如下:


//转译字符函数
function daddslashes($string) {
if(!is_array($string)) return addslashes($string);
foreach($string as $key => $val) $string[$key] = daddslashes($val);
return $string;
}
?>

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