asp模拟动态加载include file
fun.asp 模拟动态加载include的函数
<%
Function qwbminclude(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
%>
time.asp 测试上面动态加载函数效果
<!--#include file="fun.asp"-->
<%
tid = "1"
response.write include(tid&".asp")
%>
1.asp 测试加载之后的效果
<!--#include file="fun.asp"-->
<h3><%=tid%></h3>
<h1>111111111111111111</h1>
<h2><%=now()%></h2>
<%response.write include("b.asp")%>
2.asp 测试加载之后的效果
<!--#include file="fun.asp"-->
<h3><%=tid%></h3>
<h1>22222222222222222</h1>
<h2><%=now()%></h2>
<%response.write include("b.asp")%>
b.asp 这个页面是用来测试嵌套加载效果
<!--#include file="fun.asp"-->
现在时间:<hr>
<%=time()%><br />
<%=now()%><br />
<h3><%=tid%></h3>
后一页:Asp加密解密函数
- 相关阅读
- Javascript JS 限制复选框的选择个数(2)
- 在table中tr的display:block在firefox下显示布局错乱问题
- Appium元素定位方式之android_uiautomator定位
- 手机网站
- 呼伦贝尔市四季风旅行社
- 网页制作中注意应用HTML标签的问题
- 利用css3中的-webkit-font-smoothing把网页文字的毛边去掉
- 好用的免费桌面gif录制作屏幕软件
- 共有0条关于《asp模拟动态加载include file》的评论
- 发表评论
正在加载评论......
返回顶部发表评论
网友评论声明,请自觉遵守互联网相关政策法规。
您发布的评论即表示同意遵守以下条款:
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家、社会、集体和公民的合法权益;
二、不得发布国家法律、法规明令禁止的内容;互相尊重,对自己在本站的言论和行为负责;
三、本站对您所发布内容拥有处置权。
- 更多>>同类信息
- ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
- asp显示随机密码
- 通过阿里云服务接口获得ip地址详细信息
- iis点开后任务栏上有显示,但是窗口看不到的解决办法
- RSA加密解密插件
- 微软Encoder加密解密函数