您的位置:首页 > 其它

fso记数器(按日期),供初学都研究fso的使用

2007-10-26 16:28 183 查看
刚上来混的,水平有限,不要笑话啊!

<%
'fso记数器(按日期)
'QQ:30894588
path=server.MapPath(date()&".txt")'设置文件存放路径!
Set Fso=Server.CreateObject("Scripting.FileSystemObject")
If Not Fso.FileExists(path) then'判断当日文件是否存在
 Set File0=Fso.OpenTextFile(path,2,true)'不存在,创建
 File0.Close
Else'文件存在
 Set File5=Fso.OpenTextFile(path)
 If not File5.AtEndOfStream then '检查是否有值,
  '有值跳过
 Else '无值,写值
  Set Fileb=Fso.OpenTextFile(path,2)'存在,写值
  Fileb.WriteLine("1")
  Fileb.Close
 End if
 File5.Close
End if

Set File5=Fso.OpenTextFile(path)
If not File5.AtEndOfStream then '检查是否有值, 
 '有值
 Set File1=Fso.OpenTextFile(path)'取出数值
 y=Clng(File1.Readline)
 y=y+1
 
 set File2=Fso.OpenTextFile(path,2)'写入数值
 File2.WriteLine(y)
Else
 '无值
 y="1"
End if 
response.Write (date()&" 今日:"&y&"人访问")'
%> 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  file path date 笑话 qq