关于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];
}


原文地址:https://www.cnblogs.com/linewman/p/9918855.html