I am facing a big trouble when integrating PayPal Express Checkout in classic ASP.
在经典ASP中集成PayPal Express Checkout时,我遇到了大麻烦。
The code provided by PayPal at the "PayPal Integration Wizard" works perfectly when run without Option Explicit
.
PayPal在“PayPal集成向导”中提供的代码在没有Option Explicit的情况下运行时效果很好。
When I put into my coding pages and call to the functions provided, I am facing big trouble: My existing pages all use Option Explicit
.
当我输入我的编码页面并调用所提供的功能时,我遇到了大麻烦:我现有的页面都使用Option Explicit。
This results in me having to manually declare all variables in the PayPal functions.
这导致我必须手动声明PayPal函数中的所有变量。
The sample PayPal functions consist of many array/list/object/index for setting up the name/value pairs necessary to call the PayPal site. It is totally not easy for me to change it over to all correct declaration, since I am not ASP expert and project deadline is tight.
样本PayPal函数由许多数组/列表/对象/索引组成,用于设置调用PayPal站点所需的名称/值对。我完全不容易将其更改为所有正确的声明,因为我不是ASP专家,项目截止日期很紧。
Can anyone give me some advice?
谁能给我一些建议?
1 个解决方案
#1
It seems to be possible to mix "Option Explicit
"-code with non-"Option Explicit
"-code via the Execute
statement.
似乎可以通过Execute语句将“Option Explicit”-code与非“Option Explicit”-code混合使用。
Here's a small test I just made with VBScript (which applies to classic ASP as well):
这是我刚用VBScript做的一个小测试(也适用于经典ASP):
''#vb1.vbs (i.e. "your code")
Option Explicit
Dim fso, vb2, txt
Set fso = CreateObject("Scripting.FileSystemObject")
Set vb2 = fso.OpenTextFile("vb2.vbs", 1)
txt = vb2.ReadAll
MsgBox txt ''# Message 1
Execute txt
MsgBox foo ''# Message 2
and
''# vb2.vbs (i.e. "their code")
j = 100
Function foo
k = 100
foo = j + k
End Function
Results in:
Message 1: (equal to the contents of vb2.vbs)
Message 2: 200
I have no idea if this is the best way to do it, but currently I can think of no better way. Give it a try.
我不知道这是否是最好的方法,但目前我认为没有更好的方法。试试看。
Beware of namespace *es through global variables or function names in "their code".
注意通过“代码”中的全局变量或函数名称进行命名空间冲突。
#1
It seems to be possible to mix "Option Explicit
"-code with non-"Option Explicit
"-code via the Execute
statement.
似乎可以通过Execute语句将“Option Explicit”-code与非“Option Explicit”-code混合使用。
Here's a small test I just made with VBScript (which applies to classic ASP as well):
这是我刚用VBScript做的一个小测试(也适用于经典ASP):
''#vb1.vbs (i.e. "your code")
Option Explicit
Dim fso, vb2, txt
Set fso = CreateObject("Scripting.FileSystemObject")
Set vb2 = fso.OpenTextFile("vb2.vbs", 1)
txt = vb2.ReadAll
MsgBox txt ''# Message 1
Execute txt
MsgBox foo ''# Message 2
and
''# vb2.vbs (i.e. "their code")
j = 100
Function foo
k = 100
foo = j + k
End Function
Results in:
Message 1: (equal to the contents of vb2.vbs)
Message 2: 200
I have no idea if this is the best way to do it, but currently I can think of no better way. Give it a try.
我不知道这是否是最好的方法,但目前我认为没有更好的方法。试试看。
Beware of namespace *es through global variables or function names in "their code".
注意通过“代码”中的全局变量或函数名称进行命名空间冲突。