|
波纹管的代码是准备添加到您的ASP页面,它会自动开始计数安打的网页含它。 The script may be added to several pages to count hits in all of them, but it will be only one hit counter.该脚本可能会增加几页指望安打,所有这些,但它只有一个计数器。 To get hits in different pages individually, try this example若要安打个别不同的网页, 尝试这个例子
This code has been specifically create for you (next time you get to this page the code in red will change). 此代码是专门为你创造 (下次你去这个网页中的代码将改变红) 。
This script will automatically create a file named " counter777614.txt " within "cgi-bin"directory in your site ( you may change the name of the file or the subdirectory within the script ). This file will be used to save the number of times the page has been requested.此脚本会自动创建一个文件名为“ counter777614.txt ”内“的CGI斌”目录在您的网站( 您可能会更改名称的文件或子目录的脚本) 。此文件将被用来储存一些该页面已要求。
| counter777614.asp |
<% “ % Set fs = CreateObject("Scripting.FileSystemObject") 集飞秒= CreateObject ( “ Scripting.FileSystemObject ” ) Wfile=server.mappath("\") & " \cgi-bin\counter777614.txt " Wfile = server.mappath ( “ \ ” ) & “ \ 的CGI斌\ counter777614.txt ” on error resume next 关于明年的错误恢复 Set a = fs.OpenTextFile(Wfile) 设置= fs.OpenTextFile ( Wfile ) hits = Clng(a.ReadLine) 安打= Clng ( a.ReadLine ) hits = hits + 1 安打=安打+ 1 a.close a.close
if error then 如果错误则 hits = 1 安打= 1 end if 如果结束
Set a = fs.CreateTextFile(Wfile,True) 设置= fs.CreateTextFile ( Wfile ,真) a.WriteLine(hits) a.WriteLine (点击) a.Close a.Close %> % “
Number of hits: <% =hits %> 点击次数: “ % =安打% ” |
The number in your file will be increased each time your page is visited. Last line in this script will allow you to show the number of hits in your response page.人数在您的文件将增加到每一次您的网页访问。最后一行在此脚本可以让您将显示的点击次数在您的回复页面。
Check a similar counter here . It will allow you to add a hit counter to your non-asp file.类似的检查柜台这里。它将允许你添加计数器的非asp文件。 |