Home > Backend Development > PHP Tutorial > Advanced writing method of PHP addslashes_PHP tutorial

Advanced writing method of PHP addslashes_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:10:39
Original
1114 people have browsed it

This article introduces the user-defined addslashes function, which can automatically filter, post, and get illegal data.

 代码如下 复制代码
@set_magic_quotes_runtime(0);
 $MQG = get_magic_quotes_gpc();
 
 if(!$MQG && $_POST) $_POST = daddslashes($_POST);
 if(!$MQG && $_GET) $_GET = daddslashes($_GET);
 
 //转译字符函数
 function daddslashes($string) {
     if(!is_array($string)) return addslashes($string);
     foreach($string as $key => $val) $string[$key] = daddslashes($val);
     return $string;
 }

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629651.htmlTechArticleThis article introduces the user-defined addslashes function, which can automatically filter, post, and get illegal data. . The code is as follows Copy the code @set_magic_quotes_runtime(0); $MQG = get_m...
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 Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template