一个TXT保存的ASP计数器

<%
application.lock
set f_object=server.createobject("scripting.filesystemobject")
f_path=server.mappath("indexdata/counter.txt")
set file1=f_object.opentextfile(f_path)
Set f = f_object.GetFile(f_path)
fSize = f.size '判断counter.txt是否有内容,没有内容会报 :输入超出了文件尾错误
if f.size>3 then
application("counter")=file1.readline
else 
application("counter") = 8652362 '默认的计数初始值
end if
set f = nothing
file1.close
application("counter")=application("counter")+1
counter=application("counter")
set file1=f_object.createtextfile(f_path)
file1.writeline counter
file1.close
application.unlock
x=cstr(counter)
for i=1 to len(x)
gif=gif&"<img src=num\"&mid(x,i,1)&".gif>"
next
gif_counter=gif
set file1 = nothing
%>
<span style="color:#FF0000"><%=x%></span>
本博客所有文章如无特别注明均为原创。作者:sysdee复制或转载请以超链接形式注明转自 成功志
原文地址《一个TXT保存的ASP计数器
分享到:更多

相关推荐

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)