网络编程
位置:首页>> 网络编程>> Asp编程>> 通过FSO进行页面计数

通过FSO进行页面计数

作者:cnbruce 来源:cnbruce博客 发布时间:2008-11-27 16:02:00 

标签:fso,计数,统计

 

<%
Function FileCounter(counter_file)
Dim fs,txt,file
Application.lock
Set fs=Server.CreateObject("Scripting.FileSystemObject")
file=Server.MapPath(counter_file)

Set txt=fs.OpenTextFile(file,1,true)
if Not txt.atEndOfStream then
FileCounter=CLng(txt.ReadLine)
End if
FileCounter=FileCounter+1
txt.Close

On Error Resume Next
Set txt=fs.CreateTextFile(file,True)
if Err.Number=70 then
FileCounter="请先将"&file&"的只读属性去掉!"
ElseIf Err.Number<>0 then
FileCounter=Err.Description
else
txt.writeLine FileCounter
txt.close
End if
Application.Unlock
End function
%>

<%=FileCounter("num.txt")%>
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com