asp各种文件操作UTF-8

2022/11/24 12:37:2931 阅读

    '--------------生成文件
    sPath=sitemulu & "u/wx_bding/temp/"
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    If Not fso.FolderExists(Server.mappath(sPath)) Then
    fso.CreateFolder(Server.mappath(sPath))
    End If
    set wTmp=server.CreateObject("adodb.stream")
    wTmp.Type=2 
    wTmp.mode=3
    wTmp.charset="utf-8"
    wTmp.open
    wTmp.SaveToFile server.MapPath("./temp/" & pc_state &".asp"),2 
    wTmp.flush
    wTmp.Close
    set wTmp=nothing
    
    
    '--------------写入文件
    set stm=server.CreateObject("adodb.stream")
    stm.Type=2 '以本模式读取
    stm.mode=3
    stm.charset="utf-8"
    stm.open
    stm.WriteText openid
    stm.SaveToFile server.MapPath("./temp/" & f_state &".asp"),2 
    stm.flush
    stm.Close
    set stm=nothing
    '--------------判断文件是否存在
    Filepath=Server.MapPath("./temp/" & session("pc_state") &".asp")
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(FilePath) then'判断文件是否存在	
    '文件存在并且有内容
    Set f = fso.GetFile(Filepath)
    f.size > 0
    '--------------删除文件			
    Filepath=Server.MapPath("./temp/" & f_state &".txt")'删除标识文件
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(FilePath) then
    fso.deletefile(Filepath)
    end if
    set fso = nothing	

    下一条:支付宝rsa2签名验签php函数

    上一条:艾恩Asp生成Json数据类

枣庄西桥网络微信小程序微信小程序

枣庄西桥网络手机站二维码扫描手机浏览