回 帖 发 新 帖 刷新版面

主题:关于ASP计数问题--用外部文本文件非数据库

看书上写的只有方法没有代码(光盘无,电子书)在网上找了找,看不明白.这个要用到什么方法呢?

回复列表 (共5个回复)

沙发


 set   myfileobject=server.CreateObject("Scripting.FileSystemObject")

板凳

谢谢了.我试试

3 楼

能不能给这对象一两个简单的方法给我...写和读都不知道怎么写我.....

4 楼

set   myfileobject=server.CreateObject("Scripting.FileSystemObject")   
  set   mytextfile=myfileobject.OpenTextFile(server.MapPath("test.txt"),2,true)   
  mytextfile.WriteLine("这是一个测试")   '写入
  mytextfile.ReadLine   '读出

5 楼

<%
dim images(20),img
CountFile=Server.MapPath("counter/counter.txt")  ///文本文件
SET FileObject=Server.CreateObject("Scripting.FileSystemObject") 
SET Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE) 
counter=Out.ReadLine
Out.Close 
SET FileObject=Server.CreateObject("Scripting.FileSystemObject") 
SET Out=FileObject.CreateTextFile(CountFile,TRUE,FALSE)
Application.lock 
counter=counter+1
Out.WriteLine(counter) 
Application.unlock 
Out.Close 
countlen=len(counter)
response.write "&nbsp;&nbsp;&nbsp;&nbsp;页面访问统计:&nbsp;&nbsp;"
for ic=1 to countlen
image=mid(counter,ic,1)
response.write "<img src='img/"&image&".gif'>"
 next
response.write"</img>&nbsp;&nbsp;&nbsp;次"
%>
     要求放文本文件的文件夹counter有读写权限,其中的img是0-9个数字的10个图片.

我来回复

您尚未登录,请登录后再回复。点此登录或注册