频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> asp教程 -> session变量中的数组如何引用

session变量中的数组如何引用

作者:未知  来源:转载  发布时间:2005-7-28 14:37:17  发布人:acx

减小字体 增大字体

If you store an array in a Session object, you should not attempt to alter the elements of the stored array directly. For example, the following script will not work:

<% Session("StoredArray")(3) = "new value" %>

This is because the Session object is implemented as a collection. The array element StoredArray(3) does not receive the new value. Instead, the value is indexed into the collection, overwriting any information stored at that location.

It is strongly recommended that if you store an array in the Session object, you retrieve a copy of the array before retrieving or changing any of the elements of the array. When you are done with the array, you should store the array in the Session object again so that any changes you made are saved. This is demonstrated in the following example:

---file1.asp---
<%
'Creating and initializing the array
Dim MyArray()
Redim MyArray(5)
MyArray(0) = "hello"
MyArray(1) = "some other string"

'Storing the array in the Session object.
Session("StoredArray") = MyArray

Response.Redirect("file2.asp")
%>

---file2.asp---
<%
'Retrieving the array from the Session Object
'and modifying its second element.
LocalArray = Session("StoredArray")
LocalArray(1) = " there"

'Printing out the string "hello there."
Response.Write(LocalArray(0)&LocalArray(1))

'Re-storing the array in the Session object.
'This overwrites the values in StoredArray with the new values.
Session("StoredArray") = LocalArray
%>


将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· Google提醒:交换链接会..
· 100M免费ASP空间/电信线..
· 建站常识:如何使用FTP连..
· 为网站上的图片进行搜索..
· Fireworks制作可爱“葱头..
· 学习使用ASP对象和组件
· 11月美国搜索流量增长9%..
· 用Photoshop扭曲波浪滤镜..
· FTP命令详解
· [Photoshop教程]作品拼贴..
· 小组开发环境搭建(四)..
· 北京万维诉搜狐侵权索赔..
· Apache服务器配置全攻略..
· Photoshop制作花色字教程..
· 江南春突袭网游广告商
· php.ini 配置详细选项
相关文章
· 在PHP开发中如何使用Sessio..
· 学习Oracle数据库中的Kill ..
· WEB开发Struts:Session对象..
· 让不同的Servlet在一个Sess..
· Struts构架中的Session对象..
· 技巧:ASP.NET里的Session详..
· 关于ASP.NET编程里Session的..
· Hibernate中的Session什么时..
· 简单学习动态网页制作PHP中..
· 什么是Session呢?
· 动态网页技术PHP关于cookie..
· PHP开发中session应用详解
· 用xmlhttp和Java session监..
· ASP.NET 1.1 无 Cookie Ses..
· ASP Session对象的集合以及..
· 查看服务器Application/Ses..
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号