php使用header来控制cookie

作者 : admin 于 2009-09-28 15:33:33
2009
09-28

php中的setcookie函数是有bug的,bug原理不太明白,不过底下这个方法可以避免这个bug

  1. function setcookies( $name , $value , $expire , $path = "/" , $domain = "" )
  2. {
  3.     header("Set-Cookie: $name=$value; path=$path; domain=$domain; expires=".gmstrftime("%A, %d-%b-%Y %H:%M:%S GMT",$expire));
  4. }

发表评论




XHTML:你可以使用的标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(若看不到验证码,请重新加载页面。)