当前位置:K88软件开发文章中心编程语言AspAsp01 → 文章内容

相对路径转换为绝对路径函数

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:33:01

折叠展开ASP/Visual Basic Code复制内容到剪贴板
  1. '================================================  
     

  2. 函数名:ChkMapPath
     
     

  3. 作 
     
    用:相对路径转换为绝对路径
     
     

  4. 参 
     
    数:strPath 
    ----原路径
     
     

  5. 返回值:绝对路径
     
     
  6. '================================================  
     
  7. Function 
    ChkMapPath(
    ByVal 
    strPath)  
     
  8.  
     
     
     
    Dim 
    fullPath  
     
  9.  
     
     
     
    strPath 

    Replace(Replace(Trim(strPath), 
    "/"
    "\"), 
    "
    \\", 
    "
    \")  
  10.  
  11.  
     
     
     
    If 
    strPath 

    "

    Then 
    strPath 

    "
    ."  
  12.  
     
     
     
    If 
    InStr(strPath,"
    :\") 


    Then
     
  13.  
     
     
     
     
     
     
     
    fullPath 

    Server.MapPath(strPath)
     
  14.  
     
     
     
    Else
     
  15.  
     
     
     
     
     
     
     
    strPath 

    Replace(strPath,"
    ..\","")  
  16.  
     
     
     
     
     
     
     
    fullPath 

    Trim(strPath)
     
  17.  
     
     
     
     
     
     
     
    If 
    Right(fullPath, 
    1) 

    "
    \" 
    Then 
     
  18.  
     
     
     
     
     
     
     
     
     
     
     
    fullPath 

    Left(fullPath, 
    Len(fullPath) 

    1)  
     
  19.  
     
     
     
     
     
     
     
    End 
    If 
     
  20.  
     
     
     
    End 
    If 
     
  21.  
     
     
     
    ChkMapPath 

    fullPath  
     
  22. End 
    Function 
     

 



相对路径转换为绝对路径函数