管理杂谈OA答疑ERP答疑教程搜索

ASP中Server.Execute与Execute的用法


首先说明一下,server.execute()和execute是不同的,前者是asp内置对象,后者是vb语句。

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


更多精彩文章浏览...
点击右上角图标分享到朋友圈
官方网站:http://www.clicksun.cn
咨询热线:400-186-1886
服务邮箱:service@clicksun.cn