实时答疑
dim fileobject
dim textfile
dim filepath
filepath = server.MapPath("1.txt")
set fileobject = server.CreateObject("Scripting.FileSystemObject")
'下面是写入过程
if fileobject.FileExists(filepath) then
'如果记录文件已经存在
set textfile = fileobject.OpenTextFile(filepath,8,true,0)
if request("sentence")="" then
else
textfile.writeline "" & request("user") & "" & "("&now()&")"&":"& replace(replace(request("sentence"),"",">")
end if
textfile.close
else
'如果记录文件不存在
set textfile = fileobject.CreateTextFile(filepath)
textfile.WriteLine(now())
textfile.close
end if
'下面是读出过程
set textfile = fileobject.OpenTextFile(filepath,1,false,0)
do while not textfile.AtEndOfStream
Response.Write textfile.readline&""
loop
textfile.close
%>