当前位置:首页 > ASP教程 > 应用技巧

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

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!