Direkomendasikan: Penghitung Teks Sederhana Asp %Set fs = CreateObject(Scripting.FileSystemObject) Wfile=server.mappath() cgi-binwww.111cn.cn/asp/asp.html.txt on error resume next Set a = fs.OpenTextFile(Wfile) hits = Clng(a.ReadLine) hits = hits + 1 a.close if error then hits = 1 end if Set a =
Mari kita lihat contoh tutorial di bawah ini.
Mari kita lihat halaman yang dikirimkan:
<Form Action = SaveInfo.asp Method = Post>
<!-bidang Anda di sini->
<Input Tipe = Kirim Nilai = Kirim>
</form>
Mari kita lihat halaman yang menerima data dan menyimpannya.
<%
Set FS = CreateObject (Scripting.FilesystemObject)
FolderPath = server.mappath () & /cgi-bin /pesan143718
Wcounter = folderpath &/counter.txt
Set FS = CreateObject (Scripting.FilesystemObject)
Jika Fs.Folderexists (FolderPath) maka
Set a = fs.opentextFile (wcounter)
hit = clng (a.readline)
hit = hit + 1
A.close
kalau tidak
Set A = Fs.CreateFolder (FolderPath)
hit = 1
akhiri jika
Set a = fs.createTextFile (wcounter, true)
A.WriteLine (hits)
A.close
Atur fs = tidak ada
Set FS = CreateObject (Scripting.FilesystemObject)
Setel a = fs.createTextFile (FolderPath & & Hits & .txt)
Untuk setiap x dalam permintaan.form
A.WriteLine (x &: & request.Form (x))
Berikutnya
A.close
Atur a = tidak ada
Atur fs = tidak ada
%>
Bagikan: Kode Statistik Pengguna Online ASP Cukup salin tabel kode ke file teks dan simpan di situs web (/global.asa) di direktori home. Bahasa skrip = vbscript runat = server sub application_onstart Application (activeVisitors) = 0 end sub sub application_onend end sub sub session_onstart application.lock ap ap