ASP中Server.Execute与Execute的用法

发布时间:2017年1月12日 作者:未知 查看次数:2026

自:http://blog.sina.com.cn/s/blog_53a199330100ysdd.html


ASP中Server.Execute与Execute的用法

首先说明一下,Server.Execute()和Execute是不同的,前者是ASP内置对象,后者是VB语句。 powered by 25175.net

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的话,这个定义有效。




版权所有!www.sieye.cn
E.Mail:sieye@sohu.com QQ:66697110