ASP VBSCRIPT 变量声明问题

发布于 2024-07-27 01:47:10 字数 472 浏览 7 评论 0原文

首先,我

在 .asp 页面中

Class clsTesting

Function hash_call ( methodName,nvpStr )

.....
Set SESSION("nvpReqArray")= deformatNVP( nvpStrComplete )
.....

End Function

end class

遇到一个问题当我执行对此函数的调用时,一旦到达 Set SESSION("nv line 它说错误:

Microsoft VBScript runtime (0x800A01A8)
Object required: 'session'

如何定义变量? 我尝试了 dim SESSION, dim SESSION("nv... 不起作用!

是否在类之外运行它,然后不需要声明这些变量?

First of all, I got a question

in .asp page

Class clsTesting

Function hash_call ( methodName,nvpStr )

.....
Set SESSION("nvpReqArray")= deformatNVP( nvpStrComplete )
.....

End Function

end class

When I perform call to this function, once reach the Set SESSION("nv line
it say error:

Microsoft VBScript runtime (0x800A01A8)
Object required: 'session'

How do I define the variable?
I tried dim SESSION, dim SESSION("nv... not working!

Is it run it outside of class, then no need to declare those variables?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪若未夕 2024-08-03 01:47:10

尝试:

Session["nvpReqArray"] = deformatNVP( nvpStrComplete )

您不需要定义会话变量,它是 asp3 的内置对象之一。

编辑:

选项显式是一个强制您声明所有变量的指令。 (正如您所注意到的。)。
这有助于编程,并有助于确保变量的使用一致。
我建议您使用它。

Try:

Session["nvpReqArray"] = deformatNVP( nvpStrComplete )

You don't need to define a session variable, it's one of the built in objects of asp3.

Edit:

Option explicit is a directive which forces you to declare all variables. (As you've noticed.).
This aids programming, and helps ensure variables are used consistently.
I would recommend you using it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文