ASP Contents ¼¯ºÏ
Contents ¼¯ºÏ°üº¬×Åͨ¹ý½Å±¾ÃüÁîÌí¼Óµ½ application/session µÄËùÓÐÏîÄ¿¡£
Ìáʾ£ºÒª´Ó Contents ¼¯ºÏÖÐɾ³ýÏîÄ¿£¬ÇëʹÓà Remove ºÍ RemoveAll ·½·¨¡£
Óï·¨
Application.Contents(Key) Session.Contents(Key)
| ²ÎÊý | ÃèÊö |
|---|---|
| key | ±ØÐ衣Ҫȡ»ØµÄÏîÄ¿µÄÃû³Æ¡£ |
Õë¶Ô Application ¶ÔÏóµÄʵÀý
Àý×Ó 1
Çë×¢Ò⣬name ºÍ objtest ¶¼»á±»×·¼Óµ½ Contents ¼¯ºÏÖУº
<%
Application("name")="W3School"
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 />") Next %>
Àý×Ó 3
<%
Application("date")="2001/05/05"
Application("author")="W3School"
for each x in Application.Contents
Response.Write(x & "=" & Application.Contents(x) & "<br />")
next
%>
Êä³ö£º
date=2001/05/05 author=W3School
Õë¶Ô 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 />") Next %>
Àý×Ó 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