'***函数名 : CreateFile
'***函数说明: asp将内容写入文件并保存
'***参数 :
' sBody: 内容
' sFilePath: 文件路径
'***返回值 : 布尔值(成功返回True,否则返回False)
Function CreateFile(sBody, sFilePath)
On Error Resume Next
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Open
.Charset = sAppCharset
.Position = .Size
.WriteText = sBody
.SaveToFile sFilePath, 2
.Close
End With
Set objStream = Nothing
If Err Then
CreateFile = False
Else
CreateFile = True
End If
End Function
函数调用实例:CreateFile(sBody, sFilePath)