m_Root是文件名,可以使用相對路徑。
調用調用示例:
Response.Write(LoadFile("Test.htm"))
Function LoadFile(m_Root)
Dim Filename,fso,hndFile
Filename = m_Root
If Right(Filename, 1)<>"/" And Right(Filename, 1)<>"\" Then Filename = Filename & "/"
Filename = Server.MapPath(Filename & m_FileName)
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(Filename) Then ShowError("模板文件" & m_FileName & "不存在!")
set hndFile = fso.OpenTextFile(Filename)
LoadFile = hndFile.ReadAll
Set hndFile = Nothing
Set fso = Nothing
If LoadFile = "" Then ShowError("不能讀取模板文件" & m_FileName & "或文件為空!")
End Function