ASP中Server.Execute与Execute的用法
1.执行过程
dim strsubname
strsubname="print"
execute strsubname
sub print()
response.write now
end sub
2.执行带参数的过程
dim strsubname
strsubname="print("""&now&""")"
execute strsubname
sub print(str)
response.write str
end sub
3.动态包含文件
server.execute("xxx.asp")
server.execute和include相异之处:
execute method 是个呼叫一个.asp 程序并执行它,比较类似一般程式语言的 procedure call;而 #include 则仅將所包含的程序插入原程序当中。
server.execute表示将页面运行过后的html代码插入当前位置:
include表示将页面的源代码加入当前位置再做为一个整体运行
比方说你定义一个变量dim a
用server.execute后这个定义是无效的
include的话,这个定义有效