ASP 不用FSO生成TXT
...........................................如题,代码越简单越好【fso看完头痛了半天,吃了去痛片】`-_-我建站,要在网页中加...
...........................................
如题,代码越简单越好
【fso看完头痛了半天,吃了去痛片】 `-_-
我建站,要在网页中加入
只在本目录下生成一个 A.TXT
内容为:现在时间
【QQ:505675611】
...........................................
就你了 展开
如题,代码越简单越好
【fso看完头痛了半天,吃了去痛片】 `-_-
我建站,要在网页中加入
只在本目录下生成一个 A.TXT
内容为:现在时间
【QQ:505675611】
...........................................
就你了 展开
展开全部
<%
Function save_file(filename, content) '文件名,文件内容
Dim charset, stm, stream
charset = "gbk" ' 编码设置为 gbk
stm = "txt" '写入内容格式 文本格式(txt), 若是二进制的 则改成 bin
'On Error Resume Next
Set stream = Server.CreateObject("Adodb.Stream")
If stm <> "bin" Then
stream.type = 2
stream.mode = 3
stream.charset = charset
stream.open
stream.WriteText content
stream.position = 0
stream.type = 1
content = stream.Read
stream.close
End If
stream.type = 1
stream.mode = 3
stream.open
stream.write content
stream.saveToFile Server.MapPath(filename),2
stream.close
save_file = Err.Number ' 为 0 保存成功
End Function
Call save_file("A.TXT", Now())
%>
Function save_file(filename, content) '文件名,文件内容
Dim charset, stm, stream
charset = "gbk" ' 编码设置为 gbk
stm = "txt" '写入内容格式 文本格式(txt), 若是二进制的 则改成 bin
'On Error Resume Next
Set stream = Server.CreateObject("Adodb.Stream")
If stm <> "bin" Then
stream.type = 2
stream.mode = 3
stream.charset = charset
stream.open
stream.WriteText content
stream.position = 0
stream.type = 1
content = stream.Read
stream.close
End If
stream.type = 1
stream.mode = 3
stream.open
stream.write content
stream.saveToFile Server.MapPath(filename),2
stream.close
save_file = Err.Number ' 为 0 保存成功
End Function
Call save_file("A.TXT", Now())
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询