我只是想知道是否有可能取消变量.
想象一下,这是我在ASP页面中使用的#include文件
Dim MyVar MyVar = "Hello World" Response.write(MyVar) 'From now on I can not use Dim MyVar anymore as it throws an error 'I have tried MyVar = Nothing Set MyVar = Nothing 'But again, when you do Dim MyVar 'It throws an error.
原因是我不能每页多次使用相同的#INCLUDE文件.是的,我喜欢使用Option Explicit,因为它可以帮助我保持代码清洁.
*)编辑:我发现它并不像我想的那么清晰.
想象一下这是一个"include.asp"
<% Dim A A=1 Response.Cookie("beer")=A %>
现在的asp页面:
<% 'Now: I do not see whats in include above and I want to use variable A Dim A 'And I get an error 'I also cannot use the same include again: %>
你明白我的意思吗?如果我能够在Include结尾处删除A变量,问题就会解决.