1.新建一个count.ini文件,里面填写0,这个为初始计数
2.新建一个count.asp文件,代码如下:
<%
zs=int(readtext("dzbcount.ini"))
myzs=zs+1
call savetext("dzbcount.ini",myzs)

sub SaveText(FileName,Data) '这是一个用于写文本文件的过程


set fs=createobject("scripting.filesystemobject")
if instr(filename,":\")<>0 then
path=filename
else
path=server.MapPath(FileName)
end if
set ts=fs.createtextfile(path,true)
ts.writeline(data)
ts.close
set ts=nothing
set fs=nothing
end sub


function ReadText(FileName) '这是一个用于读出文件的函数
set adf=server.CreateObject("Adodb.Stream")
if instr(filename,":\")<>0 then
path=filename
else
path=server.MapPath(FileName)
end if

with adf
.Type=2
.LineSeparator=13
.Open
.LoadFromFile (path)
.Charset="GB2312"
.Position=2
ReadText=.ReadText
.Cancel()
.Close()
end with
set adF=nothing
end function
%>
3.使用方法:
要在页面显示计数,则在相应的地方加入<!--#include file="count.ini"-->
在刷新计数的页面的任何地方加入<img src="count.asp" width=0>
2.新建一个count.asp文件,代码如下:
<%
zs=int(readtext("dzbcount.ini"))
myzs=zs+1
call savetext("dzbcount.ini",myzs)
sub SaveText(FileName,Data) '这是一个用于写文本文件的过程

set fs=createobject("scripting.filesystemobject")
if instr(filename,":\")<>0 then
path=filename
else
path=server.MapPath(FileName)
end if
set ts=fs.createtextfile(path,true)
ts.writeline(data)
ts.close
set ts=nothing
set fs=nothing
end sub

function ReadText(FileName) '这是一个用于读出文件的函数
set adf=server.CreateObject("Adodb.Stream")
if instr(filename,":\")<>0 then
path=filename
else
path=server.MapPath(FileName)
end if
with adf
.Type=2
.LineSeparator=13
.Open
.LoadFromFile (path)
.Charset="GB2312"
.Position=2
ReadText=.ReadText
.Cancel()
.Close()
end with
set adF=nothing
end function
%>3.使用方法:
要在页面显示计数,则在相应的地方加入<!--#include file="count.ini"-->
在刷新计数的页面的任何地方加入<img src="count.asp" width=0>
浙公网安备 33010602011771号