用JAVASCRIPT帮我写个计数器(2)
application.unlock
'将计数值写入文件
mytextstream.writeline(cstr(application("counter")))
else
'以只读的方式打开
set mytextstream = myfso.opentextfile(countfile,1,false)
'读一行,并将值赋给计数变量
application("counter") = mytextstream.readline
end if
mytextstream.close
set myfso = nothing
end sub
sub session_onstart
session.timeout = 1
countfile = server.mappath("count.txt")
set myfso = server.createobject("scripting.filesystemobject")
application.lock
application("online") = application("online")+1
application("counter") = application("counter")+1
application.unlock
'以写方式打开文件
set mytextstream = myfso.opentextfile(countfile,2,false)
'以写行的方式将数据写入文件
mytextstream.writeline(cstr(application("counter")))
mytextstream.close
内容版权声明:除非注明,否则皆为本站原创文章。