(self,key,default='',format='',limit = [])
return result
@name 获取指定参数
            @param key<string> 参数名称，允许在/后面限制参数格式，请参考参数值格式(format)
            @param default<string> 默认值，默认空字符串
            @param format<string>  参数值格式(int|str|float|json|xss|path|url|ip|ipv4|ipv6|letter|mail|phone|正则表达式|>1|<1|=1)，默认为空
            @param limit<list> 限制参数值内容
            @param return mixed
def get(self,key,default='',format='',limit = []):
        '''
            @name 获取指定参数
            @param key<string> 参数名称，允许在/后面限制参数格式，请参考参数值格式(format)
            @param default<string> 默认值，默认空字符串
            @param format<string>  参数值格式(int|str|float|json|xss|path|url|ip|ipv4|ipv6|letter|mail|phone|正则表达式|>1|<1|=1)，默认为空
            @param limit<list> 限制参数值内容
            @param return mixed
        '''
        if key.find('/') != -1:
            key,format = key.split('/')
        result = getattr(self,key,default).strip()
        if format:
            if format in ['str','string','s']:
                result = str(result)
            elif format in ['int','d']:
                try:
                    result = int(result)
                except:
                    raise ValueError("Parameters: {}, requires int type data".format(key))
            elif format in ['float','f']:
                try:
                    result = float(result)
                except:
                    raise ValueError("Parameters: {}, float type data required".format(key))
            elif format in ['json','j']:
                try:
                    result = json.loads(result)
                except:
                    raise ValueError("Parameters: {}, requires JSON string".format(key))
            elif format in ['xss','x']:
                result = xssencode(result)
            elif format in ['path','p']:
                if not path_safe_check(result):
                    raise ValueError("Parameters: {}, the correct path format is required".format(key))
                result = result.replace('//','/')
            elif format in ['url','u']:
                regex = re.compile(
                     r'^(?:http|ftp)s?://'
                     r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'
                     r'localhost|'
                     r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'
                     r'(?::\d+)?'
                     r'(?:/?|[/?]\S+)$', re.IGNORECASE)
                if not re.match(regex,result):
                    raise ValueError('Parameters: {}, the correct URL format is required'.format(key))
            elif format in ['ip','ipaddr','i','ipv4','ipv6']:
                if format is 'ipv4':
                    if not is_ipv4(result):
                        raise ValueError('Parameters: {}, the correct ipv4 address is required'.format(key))
                elif format is 'ipv6':
                    if not is_ipv6(result):
                        raise ValueError('Parameters: {}, the correct ipv6 address is required'.format(key))
                else:
                    if not is_ipv4(result) and not is_ipv6(result):
                        raise ValueError('Parameters: {}, the correct ipv4/ipv6 address is required'.format(key))
            elif format in ['w','letter']:
                if not re.match(r'^\w+$',result):
                    raise ValueError('Parameters: {}, the requirement can only be composed of English letters'.format(key))
            elif format in ['email','mail','m']:
                if not re.match(r"^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$",result):
                    raise ValueError("Parameters: {}, the correct email address format is required".format(key))
            elif format in ['phone','mobile','m']:
                if not re.match("^[0-9]{11,11}$",result):
                    raise ValueError("Parameters: {}, mobile phone number format required".format(key))
            elif format in ['port']:
                result_port = int(result)
                if result_port > 65535 or result_port < 0:
                    raise ValueError("Parameters: {}, the required port number is 0-65535".format(key))
                result = result_port
            elif re.match(r"^[<>=]\d+$",result):
                operator = format[0]
                length = int(format[1:].strip())
                result_len = len(result)
                error_obj = ValueError("Parameters: {}, the required length is {}".format(key,format))
                if operator is '=':
                    if result_len != length:
                        raise error_obj
                elif operator is '>':
                    if result_len < length:
                        raise error_obj
                else:
                    if result_len > length:
                        raise error_obj
            elif format[0] in ['^','(','[','\\','.'] or format[-1] in ['$',')',']','+','}']:
                if not re.match(format,result):
                    raise ValueError("The format of the specified parameter is incorrect, {}:{}".format(key,format))

        if limit:
            if not result in limit:
                raise ValueError("The specified parameter value range is incorrect, {}:{}".format(key,limit))
        return result
def get ( self , key , default = '' , format = '' , limit = [ ] ) : if key . find ( '/' ) != - 1 : key , format = key . split ( '/' ) result = getattr ( self , key , default ) . strip ( ) if format : if format in [ 'str' , 'string' , 's' ] : result = str ( result ) elif format in [ 'int' , 'd' ] : try : result = int ( result ) except : raise ValueError ( "Parameters: {}, requires int type data" . format ( key ) ) elif format in [ 'float' , 'f' ] : try : result = float ( result ) except : raise ValueError ( "Parameters: {}, float type data required" . format ( key ) ) elif format in [ 'json' , 'j' ] : try : result = json . loads ( result ) except : raise ValueError ( "Parameters: {}, requires JSON string" . format ( key ) ) elif format in [ 'xss' , 'x' ] : result = xssencode ( result ) elif format in [ 'path' , 'p' ] : if not path_safe_check ( result ) : raise ValueError ( "Parameters: {}, the correct path format is required" . format ( key ) ) result = result . replace ( '//' , '/' ) elif format in [ 'url' , 'u' ] : regex = re . compile ( r'^(?:http|ftp)s?://' r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' r'localhost|' r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' r'(?::\d+)?' r'(?:/?|[/?]\S+)$' , re . IGNORECASE ) if not re . match ( regex , result ) : raise ValueError ( 'Parameters: {}, the correct URL format is required' . format ( key ) ) elif format in [ 'ip' , 'ipaddr' , 'i' , 'ipv4' , 'ipv6' ] : if format is 'ipv4' : if not is_ipv4 ( result ) : raise ValueError ( 'Parameters: {}, the correct ipv4 address is required' . format ( key ) ) elif format is 'ipv6' : if not is_ipv6 ( result ) : raise ValueError ( 'Parameters: {}, the correct ipv6 address is required' . format ( key ) ) else : if not is_ipv4 ( result ) and not is_ipv6 ( result ) : raise ValueError ( 'Parameters: {}, the correct ipv4/ipv6 address is required' . format ( key ) ) elif format in [ 'w' , 'letter' ] : if not re . match ( r'^\w+$' , result ) : raise ValueError ( 'Parameters: {}, the requirement can only be composed of English letters' . format ( key ) ) elif format in [ 'email' , 'mail' , 'm' ] : if not re . match ( r"^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$" , result ) : raise ValueError ( "Parameters: {}, the correct email address format is required" . format ( key ) ) elif format in [ 'phone' , 'mobile' , 'm' ] : if not re . match ( "^[0-9]{11,11}$" , result ) : raise ValueError ( "Parameters: {}, mobile phone number format required" . format ( key ) ) elif format in [ 'port' ] : result_port = int ( result ) if result_port > 65535 or result_port < 0 : raise ValueError ( "Parameters: {}, the required port number is 0-65535" . format ( key ) ) result = result_port elif re . match ( r"^[<>=]\d+$" , result ) : operator = format [ 0 ] length = int ( format [ 1 : ] . strip ( ) ) result_len = len ( result ) error_obj = ValueError ( "Parameters: {}, the required length is {}" . format ( key , format ) ) if operator is '=' : if result_len != length : raise error_obj elif operator is '>' : if result_len < length : raise error_obj else : if result_len > length : raise error_obj elif format [ 0 ] in [ '^' , '(' , '[' , '\\' , '.' ] or format [ - 1 ] in [ '$' , ')' , ']' , '+' , '}' ] : if not re . match ( format , result ) : raise ValueError ( "The format of the specified parameter is incorrect, {}:{}" . format ( key , format ) ) if limit : if not result in limit : raise ValueError ( "The specified parameter value range is incorrect, {}:{}" . format ( key , limit ) ) return result