我的url是 http://127.0.0.1/index.asp?aaa=1&bbb=2&ccc=3
我要删除aaa后就是
http://127.0.0.1/index.asp?bbb=2&ccc=3
删除bbb就是
http://127.0.0.1/index.asp?aaa=1&ccc=3
代码改怎么写啊
高手们帮帮忙啊
------解决方案--------------------
这个发错了!!
------解决方案--------------------
可以考虑用正则替换
------解决方案--------------------
- VBScript code
s = "http://127.0.0.1/index.asp?aaa&bbb=2&ccc=3" response.write removeQueryParam(s, "bbb") function removeQueryParam(s, p) ar = split(s,"?") if ubound(ar) = 0 then removeQueryParam = s else QueryString = ar(1) ar2 = split(QueryString, "&") for i=0 to ubound(ar2) if left(ar2(i), len(p)+1) = p & "=" or ar2(i) = p then ar2(i) = "" end if next removeQueryParam = Join(ar2, "&") removeQueryParam = replace(removeQueryParam, "&&", "&") if left(removeQueryParam, 1) = "&" then removeQueryParam = right(removeQueryParam, len(removeQueryParam)-1) end if end if end function