当前位置:编程学习 > asp >>

asp url转换函数

' 函数名:RelativePath2RootPath
' 作  用:转为根路径格式
' 参  数:url ----原URL
' 返回值:转换后的URL
'================================================
Function RelativePath2RootPath(url)
 Dim sTempUrl
 sTempUrl = url
 If Left(sTempUrl, 1) = "/" Then
  RelativePath2RootPath = sTempUrl
  Exit Function
 End If

 Dim sFilePath
 sFilePath = Request.ServerVariables("SCRIPT_NAME")
 sFilePath = Left(sFilePath, InstrRev(sFilePath, "/") - 1)
 Do While Left(sTempUrl, 3) = "../"
  sTempUrl = Mid(sTempUrl, 4)
  sFilePath = Left(sFilePath, InstrRev(sFilePath, "/") - 1)
 Loop
 RelativePath2RootPath = sFilePath & "/" & sTempUrl
End Function

补充:asp教程,ASP入门
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,