function WriteToFile(FileName,FileContent) set fso=server.createobject("scripting.filesystemobject") set fp=fso.createtextfile(server.mappath(FileName),,True) fp.write(FileContent) end function
方法二:ADODB.Stream生成文件方法 Set ccObjStream = Server.CreateObject("ADODB.Stream") With ccObjStream .Type = 2 .Mode = 3 .Open .Charset = "utf-8" .Position = ccObjStream.Size .WriteText 要生成的内容 .SaveToFile 要生成文件路径和文件名,2 .Close End With