一個將絕對路徑轉換為相對路徑的asp函數,需要的朋友可以收藏下。複製代碼代碼如下:
'================================================
' 函數名稱:ChkMapPath
' 作用:相對路徑轉換為絕對路徑
' 參數:strPath ----原路徑
' 傳回值:絕對路徑
'================================================
Function ChkMapPath(ByVal strPath)
Dim fullPath
strPath = Replace(Replace(Trim(strPath), /, /), //, /)
If strPath = Then strPath = .
If InStr(strPath,:/) = 0 Then
fullPath = Server.MapPath(strPath)
Else
strPath = Replace(strPath,../,)
fullPath = Trim(strPath)
If Right(fullPath, 1) = / Then
fullPath = Left(fullPath, Len(fullPath) - 1)
End If
End If
ChkMapPath = fullPath
End Function