数据库中输出asp脚本并执行

来源:百度知道 编辑:UC知道 时间:2024/05/04 17:47:03
数据库中输出asp脚本并执行.
在数据库中写入了asp脚本,如<%=now()%>,在读出来的时候,却不执行,要如何才执行呢?
举例:我在text中怎么输,读出来后可以让asp文件执行其asp脚本

为什么要写在数据库中?直接使用存储过程不更好?

写成文件,然后再访问该文件。

用正则表达式替换 <%=(.+)%> 为 Response.Write $1

然后用 execute("字符串") 把字符串当成脚本来运行。

给个示例吧..

<%

function RegReplace(exp_,str_,rpstr_)
Dim reg
set reg = New RegExp
reg.Pattern = exp_
reg.IgnoreCase = true
RegReplace = reg.Replace(str_, rpstr_)
end function

str = "<"&chr(37)&"=now()"&chr(37)&">"

exp1 = "<"&chr(37)&"=(.+)"&chr(37)&">"

rpstr = "Response.Write $1"

execute(RegReplace(exp1,str,rpstr))

%>

serverHTML试试,

没听明白