广州粮油批发市场地址:在asp脚本中如何取得URL的目录地址!!!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/02 06:48:24
注意是目录的地址
如:http://www.baidu.com/index.html中取得http://www.baidu.com/
不带后面的文件名
Request.ServerVariables("??????")
问错了
注意是目录的地址
如:http://www.baidu.com/index.html中取得"/"不带后面的文件名
http://www.baidu.com/gaoji/取得"/gaoji/
Request.ServerVariables("??????")

我做了一个,你试试:

w=right(left(wz,instrrev(request.ServerVariables("HTTP_HOST")&request.ServerVariables("URL"),"/")),(len(left(request.ServerVariables("HTTP_HOST")&request.ServerVariables("URL"),instrrev(request.ServerVariables("HTTP_HOST")&request.ServerVariables("URL"),"/")))-len(request.ServerVariables("HTTP_HOST"))))
response.write w

这个“w”就是最终结果

呵呵,上面的都是一句,如果觉得太长,我给你分开,就是:

wz=request.ServerVariables("HTTP_HOST")&request.ServerVariables("URL")
w=right(left(wz,instrrev(wz,"/")),(len(left(wz,instrrev(wz,"/")))-len(request.ServerVariables("HTTP_HOST"))))
response.write w

如:http://www.baidu.com/index.html
取得的就是“/”

如:http://www.baidu.com/gaoji/w.asp
取得的就是“/gaoji/”

如:http://www.baidu.com/gaoji/
取得的还是“/gaoji/”

不知道你是不是想要这样的结果,如果不是,再给我说一下,我再改改。
希望对你有所帮助!

如:http://www.baidu.com/abc/index.html

request.ServerVariables("HTTP_HOST")是www.baidu.com

request.ServerVariables("URL")是abc/index.html