Recommended: Asp time processing function A function of conversion time. The time processing in kingcms is also very powerful, so you can check it out if you have time. The date() function in PHP is so powerful that I can't help but use ASP to imitate it... but I just wrote it until the day, but I haven't written it yet. So this function has not yet been formatted with hours, minutes, and seconds, and I will add it after I have time. % '******
As mentioned earlier, this just pushes some functions together. In fact, it is better to put some function set methods in the program.
Main functions:
1. Create a delete folder
2. Get the name and number of folders in a folder
3. Get the name and number of files in a folder
4. Check whether a folder exists
5. Check whether a file exists
6. Delete the file
7. Read the content of a file
7. Create a file and write the contents into this file
In general, there are two functions: one is file operation and the other is folder operation. I just wrote it based on my needs of that "online job management system" and it is not suitable for everyone...
<%
'******************************
'Name: FSO operation class
'Author: Leng Yue, Xilou
'Date: 2006-3-1
'Website: www.xilou.net/ | www.chinaCMS.org
'Description: FSO Operation Class
'******************************
Class FsoCls
Private Fso'//Object
Public FsoObj'//Public Interface Object
'//Initialization, constructor
Private Sub Class_Initialize
Set Fso=CreateObject("Scripting.FileSystemObject")
Set FsoObj=Fso
End Sub
'//End, Release the constructor
Private Sub Class_Terminate
Set Fso=Nothing
Set FsoObj=Nothing
End Sub
'==============================================================
Function IsFileExists(ByVal FileDir)
'Judge whether the file exists. Return True if it exists, otherwise return False
'Parameter FileDir is the absolute path to the file
If Fso.FileExists(FileDir) Then
IsFileExists=True
Else
IsFileExists=False
End If
End Function
Function GetFileText(ByVal FileDir)
'Read the file content, if it exists, it returns the file's content, otherwise it returns False
'Parameter FileDir is the absolute path to the file
If IsFileExists(FileDir) Then
Dim F
Set F=Fso.OpenTextFile(FileDir)
GetFileText=F.ReadAll
Set F=Nothing
Else
GetFileText=False
End If
End Function
Function CreateFile(ByVal FileDir,ByVal FileContent)
'Create a file and write content
'The operation returns True for success, otherwise it returns False
If IsFileExists(FileDir) Then
CreateFile=False
Exit Function
Else
Dim F
Set F=Fso.CreateTextFile(FileDir)
F.Write FileContent
CreateFile=True
F.Close
End If
End Function
Function DelFile(ByVal FileDir)
'Delete a file and return True successfully, otherwise return False
'Parameter FileDir is the absolute path to the file
If IsFileExists(FileDir) Then
Fso.DeleteFile(FileDir)
DelFile=True
Else
DelFile=False
End If
End Function
Share: asp event class asplib-eventProvider.class.asp is used to obtain IP, etc. The author is so meticulous that he encapsulates all these things into classes. It's a bit over. These things can be encapsulated as processes or functions. Sub and function are also encapsulated, and it doesn't have to be a class. Your file library is not necessarily all class, some sub and function are necessary. The implemented functions include 1, showInfo(e_title,c_url,e_n
2 pages in total Previous page 12 Next page