カウンターを見つけました。ウェブサイトには訪問が少なすぎるため、そこにカウンターを置くのは本当にぼろぼろですので、店頭をサポートするために1回アクセスして録音できるシンプルなカウンターしかできません。以前は持っていましたが、見つけられなかったと落ち込んでいた。私はそれをオンラインで歌って、ついにそれを成し遂げました。特定のプログラムコードは次のとおりです。
count.aspのコードは次のとおりです。
コードコピーは次のとおりです。
<%
optionexplicit
dimfs、filename、txt、content、total、counter_lenth
counter_lenth = 1 'は、表示されたデータの最小長を設定します。実際の長さよりも少ない場合、実際の長さが勝ちます。
setfs = server.createObject( "Scripting.filesystemObject")
filename = server.mappath( "count.txt")
ifnotfs.fileexists(filename)then
fs.CreateTextFileFileName、True、True
settxt = fs.opentextfile(filename、2、true)
txt.write0'データを保存し、新しいファイルを作成してデータを書き込むファイルがない場合0
setfs = Nothing
endif
settxt = fs.opentextfile(filename)
iftxt.atendofstreamthen
アプリケーション( "counter")= 0 'ファイルにデータがない場合、アプリケーションの値( "counter")が初期化されます(フォールトトレランスのため)
それ以外
アプリケーション( "counter")= txt.readline
endif
Application.Lock
Application( "counter")= application( "counter")+1
Application.UnLock
functionsave_'saveカウント関数
setfs = server.createObject( "Scripting.filesystemObject")
filename = server.mappath( "count.txt")
content = application( "counter")
settxt = fs.opentextfile(filename、2、true)
txt.writecontent
setfs = Nothing
エンド機能
save_'callデータを保存してデータを保存します
functiondigital(counter) '表示データ関数
ディミ、mystr、scounter
scounter = cstr(counter)
fori = 1tocounter_lenth-len(scounter)
mystr = mystr& "0"
'mystr = mystr& "<imgsrc =それを相対ディレクトリに変更します。
次