遍历集合
<HTMLxmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<%
Session.Contents("FirstName")="Sam"
Session.Contents("LastName")="Woo"
Session.Contents("Age")=29
%>
<%
DimItem
ForEachIteminSession.Contents
Response.WriteSession.Contents(Item)&"<BR>"
Next
ForItem=1to3
Response.WriteSession.Contents(Item)&"<BR>"
Next
ForItem=1tosession.contents.count
Response.WriteSession.Contents(Item)&"<BR>"
Next
%>
<HTMLxmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<%
Session.Contents("FirstName")="Sam"
Session.Contents("LastName")="Woo"
Session.Contents("Age")=29
%>
<%
DimItem
ForEachIteminSession.Contents
Response.WriteSession.Contents(Item)&"<BR>"
Next
ForItem=1to3
Response.WriteSession.Contents(Item)&"<BR>"
Next
ForItem=1tosession.contents.count
Response.WriteSession.Contents(Item)&"<BR>"
Next
%>
本文展示了一个使用 ASP 通过 Session 对象遍历集合并显示其内容的示例代码。通过设置 Session 中的变量,如 FirstName、LastName 和 Age,并随后遍历这些变量进行输出。
2571

被折叠的 条评论
为什么被折叠?



