Beispiel #1
0
/**
 * 转义字符
 *
 * @param mixed $var
 */
function faddslashes($var) {
	if (is_array ( $var )) {
		foreach ( $var as $k => $v ) {
			$var [$k] = faddslashes ( $v );
		}
	} else {
		$var = addslashes ( $var );
	}
	return $var;
}
	/**
	 * 初始化http参数数据
	 */
	public static function init () {
		if (!get_magic_quotes_gpc()) {
			$_POST  = faddslashes($_POST);
            $_GET = faddslashes($_GET);
            $_COOKIE = faddslashes($_COOKIE);
            $_FILES = faddslashes($_FILES);
            $_REQUEST = faddslashes($_REQUEST);
		}
		self::$DATA = array_merge($_GET, $_POST);
		self::$METHOD = @$_SERVER['REQUEST_METHOD'];
	}