菜单
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ASP 内容 集合


❮ 完整的 Application 对象参考

Contents 集合包含通过脚本命令附加到 application/session 的所有项。

提示: 要从 Contents 集合中删除项,请使用 Remove 和 RemoveAll 方法。

语法

Application.Contents(Key)

Session.Contents(Key)

参数 描述
key 必需。要检索的项的名称

Application 对象的示例

示例 1

注意 name 和 objtest 都会被附加到 Contents 集合中

<%
Application("name")="W3Schools"
Set Application("objtest")=Server.CreateObject("ADODB.Connection")
%>

示例 2

遍历 Contents 集合

<%
for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>



<%
For i=1 to Application.Contents.Count
  Response.Write(i & "=" & Application.Contents(i) & "<br>")
下一步
%>

示例 3

<%
Application("date")="2001/05/05"
Application("author")="W3Schools"

for each x in Application.Contents
  Response.Write(x & "=" & Application.Contents(x) & "<br>")
next
%>

输出

date=2001/05/05
author=W3Schools

Session 对象的示例

示例 1

注意 name 和 objtest 都会被附加到 Contents 集合中

<%
Session("name")="Hege"
Set Session("objtest")=Server.CreateObject("ADODB.Connection")
%>

示例 2

遍历 Contents 集合

<%
for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>



<%
For i=1 to Session.Contents.Count
  Response.Write(i & "=" & Session.Contents(i) & "<br>")
下一步
%>

示例 3

<%
Session("name")="Hege"
Session("date")="2001/05/05"

for each x in Session.Contents
  Response.Write(x & "=" & Session.Contents(x) & "<br>")
next
%>

输出

name=Hege
date=2001/05/05

❮ 完整的 Application 对象参考
×

联系销售

如果您想将 W3Schools 服务用于教育机构、团队或企业,请发送电子邮件给我们
sales@w3schools.com

报告错误

如果您想报告错误,或想提出建议,请发送电子邮件给我们
help@w3schools.com

W3Schools 经过优化,旨在方便学习和培训。示例可能经过简化,以提高阅读和学习体验。教程、参考资料和示例会不断审查,以避免错误,但我们无法保证所有内容的完全正确性。使用 W3Schools 即表示您已阅读并接受我们的使用条款Cookie 和隐私政策

版权所有 1999-2024 Refsnes Data。保留所有权利。W3Schools 由 W3.CSS 提供支持