- 注册时间
- 2011-3-21
- 最后登录
- 2022-3-22
- 在线时间
- 1191 小时
- 阅读权限
- 200
- 积分
- 9457
- 帖子
- 1256
- 精华
- 0
- UID
- 1
|
直接上代码- <%
- Function GetParameter(ByVal name, ByRef dictionary)
- Dim values(), matches, match, i, cSet : cSet = "GBK"
- With New RegExp
- .Pattern = "(?:^|&)" & Server.URLEncode(name) & "=([^&]*)"
- .Global = True
- .IgnoreCase = True
- Set matches = .Execute(dictionary)
- ReDim values(matches.Count-1)
- For i=0 To matches.Count-1
- values(i) = matches(i).Submatches.Item(0)
- Next
- GetParameter = Unescape(Replace(Join(values, ", "), "+", " "))
- ' .Pattern = "^(?:[\x00-\x7f]|[\xfc-\xff][\x80-\xbf]{5}|[\xf8-\xfb][\x80-\xbf]{4}|[\xf0-\xf7][\x80-\xbf]{3}|[\xe0-\xef][\x80-\xbf]{2}|[\xc0-\xdf][\x80-\xbf])+$"
- .Pattern = "^(?:[\x00-\x7f]|[\xe0-\xef][\x80-\xbf]{2})+$"
- If .Test(GetParameter) Then cSet = "UTF-8"
- End with
- With Server.CreateObject("ADODB.Stream")
- .Type = 2
- .Charset = "iso-8859-1"
- .Open
- .WriteText GetParameter
- .Position = 0
- .Charset = cSet
- GetParameter = .ReadText(-1)
- .Close
- End With
- End Function
- Function QueryString(ByVal name)
- QueryString = GetParameter(name, Request.QueryString)
- End Function
- Function Form(ByVal name)
- Form = GetParameter(name, Request.Form)
- End Function
- %>
- <%=QueryString("gbkParam")%><br />
- <%=QueryString("utfParam")%><br />
复制代码 |
|