我只是想知道是否有可能取消变量.
想象一下,这是我在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.
Run Code Online (Sandbox Code Playgroud)
原因是我不能每页多次使用相同的#INCLUDE文件.是的,我喜欢使用Option Explicit,因为它可以帮助我保持代码清洁.
*)编辑:我发现它并不像我想的那么清晰.
想象一下这是一个"include.asp"
<%
Dim A
A=1
Response.Cookie("beer")=A
%>
Run Code Online (Sandbox Code Playgroud)
现在的asp页面:
<!--#include file="include.asp"-->
<%
'Now: I do not see whats in include above and I want to use variable A
Dim A
'And I get …Run Code Online (Sandbox Code Playgroud)