国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

根據(jù)需要動態(tài)include不同的文件

2019-11-18 20:15:41
字體:
來源:轉載
供稿:網(wǎng)友
受<! #include file="filename.asp" --> 宏限制
必須存在該文件并且會預先編譯(不管前面是否加以條件)

經(jīng)常有這樣的要求,根據(jù)不同的需求要求include不同的文件
如各個人的不同設置,所以要求能動態(tài)include文件。

代碼如下:

Function include(filename)
Dim re,content,fso,f,aspStart,aspEnd

set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.OpenTextFile(server.mappath(filename))
content=f.ReadAll
f.close
set f=nothing
set fso=nothing

set re=new RegExp
re.pattern="^/s*="
aspEnd=1
aspStart=inStr(aspEnd,content,"<%")+2
do while aspStart>aspEnd+1
  Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
  aspEnd=inStr(aspStart,content,"%/>")+2
  Execute(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
  aspStart=inStr(aspEnd,content,"<%")+2
loop
Response.write Mid(content,aspEnd)
set re=nothing
End Function

使用范例:

include("youinc.asp")

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴安县| 博乐市| 淮阳县| 津南区| 新晃| 且末县| 武隆县| 乐山市| 郓城县| 嫩江县| 宜兴市| 习水县| 舒兰市| 望都县| 乌拉特中旗| 名山县| 马尔康县| 克拉玛依市| 石嘴山市| 礼泉县| 应城市| 蓝田县| 鲁甸县| 新余市| 乐陵市| 忻州市| 尚义县| 平江县| 长岭县| 开江县| 麦盖提县| 海安县| 建平县| 文山县| 绥江县| 祁阳县| 唐山市| 西乡县| 黎川县| 郓城县| 托里县|