半点优化网 http://www.bdxc.net/
当前位置首页 > 网站技术问题> 正文

asp记录网站总访问量完整代码?

2022-05-04 09:43:48 暂无评论 181 网站技术问题 访问量   完整   代码

<%dim count,pathcount= 1path = server.Mappath(count.txt)Set fs=CreateObject(scripting.filesystemobject)if(fs.FileExists(path))then Set hs=fs.opentextfile(path) count=hs.ReadLine if session(iscount)= then session(iscount)=iscount count=count+1 end if hs.close Set hs=fs.opentextfile(path,2,true) hs.writeline(count)else Set hs=fs.createtextfile(path) hs.writeline(1)end ifresponse.write 您是第&count&位访问者!hs.closeset fs=nothing%>这样就可以, 每次新打开浏览器才会记录,而不是每次刷新就记录,如果你要每次刷新都记录也可以,追问下,我改改

建议建立数据库记录访问量,访问一次+1

猜你喜欢