通过FSO进行页面计数

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

 

<%
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")%>
标签:fso,计数,统计
0
投稿

猜你喜欢

  • 基于JS判断iframe是否加载成功的方法(多种浏览器)

    2023-08-24 04:14:52
  • Linux下设置每天自动备份数据库的方法

    2024-01-24 02:45:31
  • Python .format()函数使用方法详解

    2022-10-12 04:18:12
  • Go interface{} 转切片类型的实现方法

    2024-05-05 09:31:05
  • python字典排序的方法

    2021-06-16 03:43:40
  • JavaScript onclick 和 click 的区别详解

    2024-06-05 09:56:25
  • 打包FlaskAdmin程序时关于static路径问题的解决

    2023-01-11 20:01:26
  • 浅谈购物类网站如何保持视觉设计的一致性

    2009-03-30 16:02:00
  • 使用Python编写提取日志中的中文的脚本的方法

    2023-12-14 16:04:44
  • pyqt5 QProgressBar清空进度条的实例

    2022-11-28 03:04:08
  • 解决Win10系统安装MySQL8.0遇到的问题

    2024-01-19 12:55:27
  • 如何计算多个订单的核销金额

    2024-01-26 17:56:31
  • javascript调试之DOM断点调试法使用技巧分享

    2023-09-24 12:24:18
  • Python采集电影评论实战示例

    2022-02-25 22:14:37
  • python实现读取excel文件中所有sheet操作示例

    2022-04-25 15:00:36
  • python实现AES算法及AES-CFB8加解密源码

    2022-06-14 01:24:01
  • python 引用传递和值传递详解(实参,形参)

    2023-10-25 15:57:44
  • ASP编程入门进阶(十):Global.asa文件

    2008-07-12 07:05:00
  • python list数据等间隔抽取并新建list存储的例子

    2023-12-30 13:10:04
  • golang日志框架之logrus的使用

    2024-04-25 15:17:45
  • asp之家 网络编程 m.aspxhome.com