发布时间:2011-02-18 18:46:38作者:知识屋
来自国内某著名论坛的一个提交转义字符代码,在此分享
- function daddslashes($string, $force = 0) {
- !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
- if(!MAGIC_QUOTES_GPC || $force) {
- if(is_array($string)) {
- foreach($string as $key => $val) {
- $string[$key] = daddslashes($val, $force);
- }
- } else {
- $string = addslashes($string);
- }
- }
- return $string;
- }