建站常识

ASP FSO 读取,写入文本

发布时间 | 2015/11/17  点击 | 

'读取文件
Set fso = CreateObject("Scripting.FileSystemObject")
Set htmlwrite=fso.OpenTextFile(server.MapPath("/inc/config.asp"))
strOut=htmlwrite.ReadAll
htmlwrite.close
response.write(strOut)


'request.收集文档并生成文件
Dim txtFile,FSO,myFile,a,b,txt
a = request("config")
txtFile = Server.mapPath("/inc/config.asp")
Set FSO = createObject("Scripting.FileSystemObject")
Set myFile = FSO.createTextFile(txtfile,True)
myFile.writeLine(a) '第一次写入
myFile.close '注意这里要关闭
set myFile = Nothing

相关信息