分享

写回答

发帖

[提问] 发布系统,生成问题,斑竹大哥看下能改吗

GoDaddy GoDaddy 721 人阅读 | 4 人回复

发表于 2009-12-21 22:48:09 | 显示全部楼层 |阅读模式

还是生成以后0字节,看下帮忙能修改下吗







'===========================================
        '作  用:创建文本文件
        '===========================================
        Public Function CreatedTextFile(ByVal fromPath, ByVal body)
                On Error Resume Next
                Dim fso,fff
                If InStr(fromPath, ":") = 0 Then fromPath = Server.MapPath(fromPath)
                Set fso = Server.CreateObject(ServerObject(1))
                Set fff = fso.OpenTextFile(fromPath, 2,True)
                fff.Write body
                fff.Close
                Set fff = Nothing
                Set fso = Nothing
                If Err.Number <> 0 Then Err.Clear
        End Function
        '===========================================
        '作  用:自动生成目录
        '===========================================
        Public Function CreatPathEx(ByVal sPath)
                sPath = Replace(sPath, "/", "\")
                sPath = Replace(sPath, "\\", "\")
                On Error Resume Next
                Dim strHostPath,strPath
                Dim sPathItem,sTempPath
                Dim i,fso
                Set fso = Server.CreateObject(ServerObject(1))
                strHostPath = Server.MapPath("/")
                If InStr(sPath, ":") = 0 Then sPath = Server.MapPath(sPath)
                If fso.FolderExists(sPath) Or Len(sPath) < 3 Then
                        CreationPath = True
                        Exit Function
                End If
                strPath = Replace(sPath, strHostPath, vbNullString,1,-1,1)
                sPathItem = Split(strPath, "\")
                If InStr(LCase(sPath), LCase(strHostPath)) = 0 Then
                        sTempPath = sPathItem(0)
                Else
                        sTempPath = strHostPath
                End If
                For i = 1 To UBound(sPathItem)
                        If sPathItem(i) <> "" Then
                                sTempPath = sTempPath & "\" & sPathItem(i)
                                If fso.FolderExists(sTempPath) = False Then
                                        fso.CreateFolder sTempPath
                                End If
                        End If
                Next
                Set fso = Nothing
                If Err.Number <> 0 Then Err.Clear
                CreatPathEx = True
        End Function

回答|共 4 个

respr

发表于 2009-12-21 22:53:45 | 显示全部楼层

这个确实不懂,不好意思啊

hswd

发表于 2009-12-22 09:08:06 | 显示全部楼层

等待高手帮忙改下
RAKSmart

add.c

发表于 2009-12-22 09:13:44 | 显示全部楼层

你的代码和原来遇到的不一样
不过还是建议你尝试下把Set fff = fso.OpenTextFile(fromPath, 2,True)修改为Set fff = fso.OpenTextFile(fromPath, ,True)试试
另外记得先把网站所在目录设置读写权限

hswd

发表于 2009-12-22 09:16:59 | 显示全部楼层

恩,。 我去试一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则