zoukankan      html  css  js  c++  java
  • 会话控制之session和cookie(20161107)

    注:除了登录页面,每个页面,包括处理页面也要加,为了提高安全性

    session尽量不用,因为很占内存

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    
    <body>
    
    <!--1.session
    (1)session存储在服务器的
    (2)session每个人存一份
    (3)session有默认的过期时间
    (4)session里面可以存储任意类型的数据
    安全,对服务造成压力
    用法:
    1.当一个页面需要使用session的时候,需要在页面顶部加session_start();//开启session,前面不能出现任何PHP代码
    2.操作session
        赋值  $_SEESION["uid"] = "";
        取值  $_SESSINO["uid"]
    
    2.cookie
    (1)cookie存储在客户端的
    (2)cookie每人存一份
    (3)cookie没有默认过期时间
    (4)cookie只能存储字符串
    不安全,不会对服务器造成压力
    用法:
    1.操作cookie
        赋值:setcookie(key,value)
        取值:$_COOKIE["uid"]-->
    
    <?php
        $_SESSION["uid"] = "zhangsan";
            
        /*echo $_SESSION["uid"];*/
    
    
        setcookie("uid","lisi");
        
        /*echo $_COOKIE["uid"];*/
    ?>
    
    
    
    
    
    
    
    
    
    </body>
    </html>
  • 相关阅读:
    《最优化导论》-8梯度方法
    《最优化导论》-7一维搜索方法
    《最优化导论》-6集合约束和无约束优化问题基础
    ubuntu set up 3
    ubuntu set up 2
    ubuntu set up 1
    Xavier and Kaiming Initialization
    Network Initialization: Fan-in and Fan-out
    The Softmax function and its derivative
    GNU Screen使用
  • 原文地址:https://www.cnblogs.com/zsczsc/p/6122500.html
Copyright © 2011-2022 走看看