% Session("homepage")=true %> <% Application.Lock Set fs=Server.CreateObject("Scripting.FileSystemObject") file=Server.MapPath("counter.txt") Set txt=fs.OpenTextFile(file) '打开成只读文件 If Not txt.atEndOfStream Then Application("counter")=txt.ReadLine '读取文件中的数字,并指定给Application变量 End If txt.Close '关闭文件 Application("counter")=Application("counter")+1 '将Application("counter")变量加1 counter=Application("counter") '将改变后的Application变量的值指定给变量counter Set txt=fs.CreateTextFile(file,True) '建立新文本文件,将原来的文件覆盖掉 txt.WriteLine counter '将新的计数值counter写入文件 txt.Close '关闭文件 Application.Unlock %>
|
|
|
浏览人数 <%=counter%>
|