本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>技术文章>>asp技术文章

aspCookie函数运用

  • 事实上客户机上的Cookie字典是以字符串的形式存在:

    info=Myname=jeff&Gender=male&Myheight=172

      如果用户没有指定“子键”名而直接引用Cookies变量,将会返回一个包含所有的“子键”名及值的字符串。例如上面这个例子包含三个“子键”:"Myname"、"Gender"和"Myheight",当用户没有指定其“子键”而直接通过Request.Cookies("info")来引用时,则会得到下列字符串:

    info=Myname=jeff&Gender=male&Myheight=172

      如果要把Cookie中读取的所有数据,可以用下面的代码得到:

    <%
    For each cookie in Request.Cookies
    if Not cookie.HasKeys then
    Response.write cookie & "=" & Request.Cookies(cookie)
    Else
    for each key in Request.Cookies(cookie)
    Response.write cookie&"("&key&")"&"="& Request.Cookies(cookie)(key)
    next
    end if
    next
    %>

      或者:

    <%
    'Declare counter variables
    Dim Cookie, Subkey
    'Display the entire cookie collection.
    For Each Cookie in Request.Cookies
    Response.Write Cookie
    If Request.Cookies(Cookie).HasKeys Then
    'Display the subkeys
    For Each Subkey in Request.Cookies(Cookie)
    Response.Write Subkey & "=" & Request.Cookies(Cookie)(Subkey) & "<BR>"
    Next
    Else
    Response.Write ":No subkeys in this cookie<BR>"
    End If
    Next
    %>


    页数:第[0]页||第[1]页||
  • [时间:2008-12-16 19:51:32][点击:]

  • 上下篇文章加载中...
本站关键字:宁波网络公司/宁波网站建设公司/宁波网站制作公司/宁波做网站公司