<?php
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<script language="javascript">n";;;
$Cookie.=’function makeYearExpDate(min){;;
var expire = new Date();;;
expire.setTime(expire.getTime() + ((min * 60) * 1000));;;
expire = expire.toGMTString();;
return expire;;
};;
expr =makeYearExpDate(’.$CExpr.’);’;;;
$Cookie.="n".$CookieString."n";;;
$Cookie.="document.cookie=astr;n</script>n";;;
}else{;;
$Cookie.="n<script language="javascript">n";;;
$Cookie.="document.cookie=’$CName=$CValue;path=/’;";;;
$Cookie.="n</script>n";;;
};;
echo $Cookie;;;
};;
}
?>;;;
原作者:不详;;
标签: