ASP读取文件:
简洁版:
CreateObject("Scripting.FileSystemObject").OpenTextfile(Server.MapPath("Muma.txt"),1,False).Readall
完整版:
set fs=server.createobject("scripting.filesystemobject")
file=server.mappath("pic/fuck.txt")
set txt=fs.opentextfile(file,1,true)
if not txt.atendofstream then line=txt.readall 'ReadLine从文件中读取一行数据;Read(N)从文件中读取N个字节的数据;ReadAll读取文件中的所有数据
'response.write "
" '显示到textarea
|
ASP写入/保存文件:
简洁版:
Server.CreateObject("Scripting.FileSystemObject").OpenTextFile(Server.MapPath("test.txt"),2,True).WriteLine Request("TxtData")
完整版:
Set Fs=Server.CreateObject("Scripting.FileSystemObject")
Set File=Fs.OpenTextFile(Server.MapPath("ip.txt"),2,True) '2覆盖,8追加;True文件不存在则自动创建.Flase不自动创建
File.Writeline ip+":"+port 'file.writeline 会写入换行符,file.write 不会写入换行符
File.Close
|
文章来源于lcx.cc:【Asp】ASP读取文件 ASP写入/保存文件
相关推荐: 【VB技巧】VB ActiveX 启动方式[过360启动]
VB ActiveX 过360安全卫士提示启动方式,VB ActiveX 过360安全卫士提示启动,VB ActiveX 过安全卫士提示启动方式,VB ActiveX 过安全卫士提示启动,VB ActiveX 过360提示启动方式,VB ActiveX…
评论