Home > Backend Development > PHP Tutorial > PHP5下$_SERVER变量不再受magic_quotes_gpc保护的弥补方法_PHP

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

WBOY
Release: 2016-06-01 12:09:15
Original
1288 people have browsed it

复制代码 代码如下:
$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;
}
?>

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template