asp读取js文件,编辑JS文件,保存JS文件
我有一个JS文件,现在想写一个ASP来管理JS文件,ASP能读取到这个JS文件,能编辑,能保存。应该怎么写呢?
'加载指定文件 Function LoadFile(url) Dim stream On Error Resume Next Set stream = Server.CreateObject("ADODB.Stream") With stream .Type = 2 .Mode = 3 .Open .LoadFromFile url .Charset = "gb2312" .Position = 2 LoadFile = .ReadText .Close End With Set stream = Nothing End Function '保存文件 function writeFile(str,path) dim stream writeFile = 1 On Error Resume Next set stream = server.CreateObject("adodb.stream") with stream .type = 2 .mode = 3 .charset = "gb2312" .open .position = 0 .writetext str .saveToFile path,2 .Close end with If Err.Number<>0 then writeFile = 0:err.clear set stream = nothing end functiondim content