获取域名后的第一个文件夹

xuyong001 2009-07-21 11:42:58
网页的url为:

http://127.0.0.1/test/position/index.asp


如何获得域名后的第一个文件夹也就是:
test

<%=request.ServerVariables("URL") %>获取的是:/test/position/index.asp

<%=mid(request.ServerVariables("URL"),2,4) %>虽然能获得,test,
但如果这个文件夹是不固定的就没有办法,如果变成
http://127.0.0.1/test12/position/index.asp就又变得不可行了。
...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
pzhuyy 2009-07-21
  • 打赏
  • 举报
回复
结帖。
xuyong001 2009-07-21
  • 打赏
  • 举报
回复
谢谢
xuyong001 2009-07-21
  • 打赏
  • 举报
回复
OK,成功.
lzp4881 2009-07-21
  • 打赏
  • 举报
回复
<%=split(request.ServerVariables("URL"),"/")(1)%>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧