码迷,mamicode.com
首页 > 其他好文 > 详细

用For Each语句对Session.Contents树组进行遍历

时间:2016-07-20 13:33:15      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

<%@ LANGUAGE=VBScript codepage ="936" %>
<% Option Explicit %>
您的sessionID号是:<%=session.sessionid%><br>
<%
Response.Write "在你的程序中一共使用了 " & Session.Contents.Count & " 个Session变量"
Dim strName, iLoop
For Each strName in Session.Contents
‘判断一个Session变量是否为数组
If IsArray(Session(strName)) then
‘如果是数组,那么罗列出所有的数组元素内容
For iLoop = LBound(Session(strName)) to UBound(Session(strName))
Response.Write strName & "(" & iLoop & ") - " & _
Session(strName)(iLoop) & "<BR>"
Next
ElseIf IsObject(Session(strName)) Then
Response.Write strName & " - 是类<BR>"
Else
‘如果不是数组,那么直接显示
Response.Write strName & " - " & Session.Contents(strName) & "<BR>"
End If
Next
%>

用For Each语句对Session.Contents树组进行遍历

标签:

原文地址:http://www.cnblogs.com/lykouyi/p/5687883.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!