asp往文件中追加重写内容源代码

  asp向文件中追加内容,重写文件内容vbscript源代码

<%
'filename:文件名
'ct:内容
'readwritemode:1只读 2重写 8添加,可以通过设置此参数实现文件的重写或者添加新内容
'create:是否创建新文件 ,true/false
'encoding:编码,0:ascii  -1:unicode   -2:系统缺省,中文系统为ANSI
function WriteFile(filename,ct,readwriteMode,create,encoding) 
  set fso=server.CreateObject("scripting.filesystemobject")
  if not fso.FileExists(server.MapPath(filename))then create=true'文件不存在则设置create为true
  set stream=fso.OpenTextFile(server.MapPath(filename),readwritemode,create,encoding)
  stream.write ct
  stream.close
  set fso=nothing
end function
ct=request.Form("ct")
if ct<>"" then WriteFile "abc.txt",ct,2,false,-2
%>
<form method="post" action="x.asp"">
<input type="text" name="ct" /><input type="submit" value="提交" />
</form>

 

加支付宝好友偷能量挖...


原创文章,转载请注明出处:asp往文件中追加重写内容源代码

评论(0)Web开发网
阅读(133)喜欢(0)Asp/VBScript