受<! #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")
恩,按照你的方法成功解决乱码
@echo off都没有解释为什要有这个 还有后面的那个*。bat
怎么没有一个回首页的连接···[face09]
你是转载高手吗?
这是叠罗汉么? 随便就往上面放。。。。。 一点规律都没有就上面写了四类···· 哎 年轻人哪
里面的东西不能自动换行。看起来真郁闷。。[face12]
从别的地方转载的,你爱看就看,不爱看也没了[face62]
[face78] 太多了前面要先有个目录···· 累、
[face78]无聊! 注册了有什么用啊 应该还没有人注册····