RelativePath2RootPath = sTempUrl
&n">

asp代码 显示绝对路径

80酷酷网    80kuku.com

  显示

<%
 ' 转为根路径格式
 Dim sTempUrl
 sTempUrl = url
 If Left(sTempUrl, 1) = "/" Then
  RelativePath2RootPath = sTempUrl
 End If
 Dim sWebEditorPath
 sWebEditorPath = Request.ServerVariables("SCRIPT_NAME")
 sWebEditorPath = Left(sWebEditorPath, InstrRev(sWebEditorPath, "/") - 1)
 Do While Left(sTempUrl, 3) = "../"
  sTempUrl = Mid(sTempUrl, 4)
  sWebEditorPath = Left(sWebEditorPath, InstrRev(sWebEditorPath, "/") - 1)
 Loop
 RelativePath2RootPath = sWebEditorPath & "/" & sTempUrl
 ' 根路径转为带域名全路径格式
 Dim sHost, sPort
 sHost = Split(Request.ServerVariables("SERVER_PROTOCOL"), "/")(0) & "://" & Request.ServerVariables("HTTP_HOST")
 sPort = Request.ServerVariables("SERVER_PORT")
 If sPort <> "80" Then
  sHost = sHost & ":" & sPort
 End If
 RootPath2DomainPath = sHost & url
 %>
<%=RootPath2DomainPath%><%=RelativePath2RootPath%>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: