zoukankan      html  css  js  c++  java
  • 关于TP,PHP和shopnc 的cookie

    PHP:
    setcookie(name, value, expire, path, domain);//expire 为时间戳


    setcookie("user", "Alex Porter", time()+3600);
    setcookie("user", "", time()-3600);


    TP:封装

    cookie('name','value',3600); // 指定cookie保存时间,不支持负值清空,用null(不是时间戳)
    cookie('name','value',array('expire'=>3600,'prefix'=>'think_'))



    NC:封装 

    setNcCookie( $name, $value, $expire = "3600", $path = "", $domain = "", $secure = FALSE )// 指定cookie保存时间,负值为过期(不

    是时间戳)

    function cookie( $name = "" )
    {
    $name = defined( "COOKIE_PRE" ) ? COOKIE_PRE.$name : strtoupper( substr( md5( MD5_KEY ), 0, 4 ) )."_".$name;
    return $_COOKIE[$name];
    }


  • 相关阅读:
    CentOS7- 配置阿里镜像源
    MySQL学习笔记
    OSI&TCP/IP模型
    加密算法学习
    golang学习笔记
    Redis学习总结整理
    TCP
    HTTP/HTTPS
    HTTP2
    MVCC
  • 原文地址:https://www.cnblogs.com/linewman/p/9918855.html
Copyright © 2011-2022 走看看