如何取得服務器端的appl_physical_path
Sub Application_Onstart
filepath=request.ServerVariables("appl_physical_path")‘這句不對,如何改
filename="filepath&count/counter.txt"
set fs=createobject("scripting.filesystemobject")
if not fs.fileexists(filename) then
fs.createtextfile(filename)
set f=fs.getfile(filename)
s=0
Set ts = f.OpenAsTextStream(2, -2)
ts.writeline(cstr(s))
ts.close
else
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(1, -2)
s=ts.readline
ts.close
end if
application.lock
application("visitor")=s
application.unlock
end sub
如果一個不在根目錄下的asp文件(F:/projectDir/manage/manage.asp),第一個被請求,執行global.asa 文件中的filepath=server.mappath(count/counter.txt)時,filepath=?
物理路徑:filepath=server.mappath(request.servervariables("path_info"))
相對路徑:filepath=server.mappath("count/counter.txt")
filepath=request.ServerVariables("appl_physical_path")‘這句不對,如何改
filename="filepath&count/counter.txt"
set fs=createobject("scripting.filesystemobject")
if not fs.fileexists(filename) then
fs.createtextfile(filename)
set f=fs.getfile(filename)
s=0
Set ts = f.OpenAsTextStream(2, -2)
ts.writeline(cstr(s))
ts.close
else
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(1, -2)
s=ts.readline
ts.close
end if
application.lock
application("visitor")=s
application.unlock
end sub
如果一個不在根目錄下的asp文件(F:/projectDir/manage/manage.asp),第一個被請求,執行global.asa 文件中的filepath=server.mappath(count/counter.txt)時,filepath=?
物理路徑:filepath=server.mappath(request.servervariables("path_info"))
相對路徑:filepath=server.mappath("count/counter.txt")
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.