经常有这样的要求,根据不同的需求要求include不同的文件如各个人的不同设置,所以要求能动态include文件受<! #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=nothing End Function
使用范例:
include("youinc.asp")
简介 “ 大家好我是帅哥欢迎来到帅哥的程序人生我会把经历分享出来助你了解圈内...
本文转载自微信公众号「Linux开发那些事儿」,作者 LinuxThings 。转载本文请联...
2月26日消息 众所周知,Windows 10 的安全更新和其他重要累计更新通常是在同一天...
互联网业务往往使用MySQL数据库作为后台存储,存储引擎使用InnoDB。我们针对互联...
不少Windows 10用户之前都抱怨一个问题,那就是系统的屏幕出现了渲染问题,而微...
一、Postman背景介绍 用户在开发或者调试网络程序或者是网页B/S模式的程序的时候...
开发过程中,我们经常会遇到代码回滚的情况。正常人都知道,git 回滚有两大宝: ...
console.log ,作为一个前端开发者,可能每天都会用它来分析调试,但这个简单函...
继 Australis 和 Photon 之后,Mozilla 现又酝酿为 Firefox 带来名为Proton的全...
前言 aop即是面向切面编程,众多Aop框架里Castle是最为人所知的,另外还有死去的...