首页| 新闻| 科技| 人物| 科学| 话题| 运营| 设计| 开发| 服务器| 学院| 产品| 网文| 娱乐| 游戏| 图片
受<! #include file="filename.asp" --> 宏限制必须存在该文件并且会预先编译(不管前面是否加以条件)
经常有这样的要求,根据不同的需求要求include不同的文件如各个人的不同设置,所以要求能动态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=nothingEnd Function%>
使用范例:include("youinc.asp")
为什么越来越多的网站域名不加
jq判断输入框必填(适合多条件搜
windows wamp中配置安装xhprof步骤
校园甜美的背影,洋溢着青春烂漫的回忆
南国有佳人,容华若桃李
游览三河古镇景点:望月阁、古民居、一人巷
大蜀山森林公园美景
路边摊小吃 酒香不怕巷子深
特色路边摊小吃 下班路上的一道美食
爷爷都是从孙子走过来的
我太帅了,睡不着咋整啊
新闻热点
疑难解答
图片精选
十天学会ASP之第一天
什么才是提高ASP性能的最佳选择(续
网友关注