1、使用adodb.stream實現(xiàn)的 一般虛擬主機都提供 復(fù)制代碼 代碼如下: function loadtempletfile(byval path) on error resume next dim objstream set objstream = server.createobject("adodb.stream") with objstream .type = 2 .mode = 3 .open .loadfromfile server.mappath(path) if err.number <> 0 then err.clear response.write("預(yù)加載的模板[" & path & "]不存在!") response.end() end if .charset = "" & chrset & "" .position = 2 loadtempletfile = .readtext .close end with set objstream = nothing end function
2、用fso實現(xiàn)模板的加載速度快,但好多虛擬主機不提供fso功能 復(fù)制代碼 代碼如下: '******************************************************************************************************* '函數(shù)名:LoadTemplate '作 用:取出模板內(nèi)容 '參 數(shù):TemplateFname模板地址 '返回值:模板內(nèi)容 '******************************************************************************************************** Function LoadTemplate(TemplateFname) on error resume next Dim FSO, FileObj, FileStreamObj Set FSO = CreateObject("scripting.filesystemobject")