忘了从哪个程序里提出来的了,保存下来先,感谢写出这段代码的同志
Function include(posturl)
Dim re,content,fso,f,aspStart,aspEnd
set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.OpenTextFile(server.mappath(posturl))
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
本文介绍了一段用于解析并执行ASP代码中内联代码的VBScript函数。该函数通过正则表达式处理ASP文件内容,提取并执行<% %>标记内的代码片段,实现了动态响应内容的生成。
1779

被折叠的 条评论
为什么被折叠?



