Home >php教程 >php手册 >字符前加上反斜杠,包括 单引号、双引号、反斜杠 php代码

字符前加上反斜杠,包括 单引号、双引号、反斜杠 php代码

WBOY
WBOYOriginal
2016-06-13 10:11:33848browse

字符前加上反斜杠,包括 单引号、双引号、反斜杠 php教程代码

function d_addslashes($string, $force = 0) {
 if(!$globals['magic_quotes_gpc'] || $force) {
  if(is_array($string)) {
   foreach($string as $key => $val) $string[$key] = d_addslashes($val, $force);
  }
  else $string = addslashes($string);
 }
 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
Previous article:asp防sql注入源程序Next article:php简单数据保存程序