一个TXT保存的ASP计数器
成功志
一个TXT保存的ASP计数器
2011-11-23 ok12
<%

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>
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容