推薦:ASP實例:計數器程序詳解Active Server Pager(動態服務器主頁,簡稱ASP),通過讀寫服務器的文件,結合script語言(VBscript或Jscript)和html碼可以方便地實現頁面計數器功能?,F流行的ASP教材和網絡上的ASP教程都談到
開啟FSO權限 在 開始-“運行”中執行regsvr32.exe scrrun.dll即可。如想關閉FSO權限,在上述命令中加/u參數。注冊表中的鍵值位置:HKEY_CLASS_BOOT/F.S.O .FSO中有個方法是CreateFolder,但是這個方法只能在其上一級文件夾存在的情況下創建新的文件夾,所以我就寫了一個自動創建多級文件夾的函數,在生成靜態頁面等方面使用非常方便。函數:
以下為引用的內容: ’ -------------------------------- ’ 自動創建指定的多級文件夾 ’ strPath為絕對路徑 Function AutoCreateFolder(strPath) ’ As Boolean On Error Resume Next Dim astrPath, ulngPath, i, strTmpPath Dim objFSO If InStr(strPath, "/") <=0 Or InStr(strPath, ":") <= 0 Then AutoCreateFolder = False Exit Function End If Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(strPath) Then AutoCreateFolder = True Exit Function End If astrPath = Split(strPath, "/") ulngPath = UBound(astrPath) strTmpPath = "" For i = 0 To ulngPath strTmpPath = strTmpPath & astrPath(i) & "/" If Not objFSO.FolderExists(strTmpPath) Then ’ 創建 objFSO.CreateFolder(strTmpPath) End If Next Set objFSO = Nothing If Err = 0 Then AutoCreateFolder = True Else AutoCreateFolder = False End If End Function |
調用方法:
以下為引用的內容: MyPath = "C:/a/b/c/" |
分享:ASP實例學習:隨機生成文件名的函數以下為引用的內容: <html> <meta http-equiv="Refresh" content="2"> <!-- Place this
新聞熱點
疑難解答