asp网页计数器session防止刷新不起作用
asp网页计数器session防止刷新不起作用,我参考了好多资料不管怎么写就是不起作用,到底要怎么办呢?高手指点啊!我的代码是这样的:<%@LANGUAGE="VBSCR...
asp网页计数器session防止刷新不起作用,我参考了好多资料不管怎么写就是不起作用,到底要怎么办呢?高手指点啊!
我的代码是这样的:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
On Error Resume Next
Dim FSO,openFile,visitors,filePath
filePath=Server.MapPath("visitor.txt")
visitors=0
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
If IsObject(FSO) Then
Set openFile=FSO.OpenTextFile(filePath)
visitors=openFile.ReadAll
If Session("visitor")="" Then
visitors=visitors+1
Set openFile=FSO.CreateTextFile(filePath)
openFile.Write(visitors)
End If
openFile.Close
Set openFile=Nothing
End If
Set FSO=Nothing
If Err Then visitors="Error"
Session("visitor")="Locked"
Response.Write "<span style=""color:#FF0000;"">"&visitors&"</span>"
%> 展开
我的代码是这样的:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
On Error Resume Next
Dim FSO,openFile,visitors,filePath
filePath=Server.MapPath("visitor.txt")
visitors=0
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
If IsObject(FSO) Then
Set openFile=FSO.OpenTextFile(filePath)
visitors=openFile.ReadAll
If Session("visitor")="" Then
visitors=visitors+1
Set openFile=FSO.CreateTextFile(filePath)
openFile.Write(visitors)
End If
openFile.Close
Set openFile=Nothing
End If
Set FSO=Nothing
If Err Then visitors="Error"
Session("visitor")="Locked"
Response.Write "<span style=""color:#FF0000;"">"&visitors&"</span>"
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询