Home >php教程 >php手册 >在PHP3中实现SESSION的功能(二、COOKIE函数库:cookie.inc.php3)(转译)

在PHP3中实现SESSION的功能(二、COOKIE函数库:cookie.inc.php3)(转译)

WBOY
WBOYOriginal
2016-06-21 09:13:361566browse

cookie|session|函数

if (!isset($__cookie_inc__)){
$__cookie_inc__=1;
function JsSetCookie($CName,$CValue,$CExpr=FALSE){
// 这个函数允许你在HTML头标记之后设置cookie ,
// 可以作SetCookie函数的补充,甚至代替。
// $CName.....: cookie 的名字
// $CValue....: cookie 的值
// $CEXpr.....: cookie 的有效期,以分钟为单位,也可以修改加入小时,天数
  
if($CExpr > 0){
$CookieString="astr= '$CName' + '=' + '$CValue' + ';expires=' + expr + ';path=/';";
$Cookie.="\n\n";
}else{
$Cookie.="\n\n";
}
echo $Cookie;
}
}
?>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn