函数:setcookie()
时间:2008-04-29 来源:小飞虫
setcookie
送出 Cookie 信息到浏览器。
语法: int setcookie(string name, string value, int expire, string path, string domain, int secure);
返回值: 整数
函数种类: 网络系统
内容说明
本函数会跟着标头 Header 送出一段小信息字符串到浏览器。使用本函数要在送出 HTML 资料前,实际上 cookie 也算标头的一部份。本函数的参数除了第一个 name 之外,都是可以省略的。参数 name 表示 cookie 的名称;value 表示这个 cookie 的值,这个参数为空字符串则表示取消浏览器中该 cookie 的资料;expire 表示该 cookie 的有效时间;path 为该 cookie 的相关路径;domain 表示 cookie 的网站;secure 则需在 https 的安全传输时才有效。想得到更多的 cookie 信息可以到
[url=javascript:if(confirm('http://www.netscape.com/newsref/std/cookie_spec.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='../www.netscape.com/newsref/std/cookie_spec.html']http://www.netscape.com/newsref/std/cookie_spec.html[/url]
,由 cookie 原创者 Netscape 所提供的完整信息。
使用范例
[email protected] (27-May-1999) 所提供的 setcookie() 及 header() 范例。
Cookie Check
Cookie Check Status:
%s
;',
$status ? "00FF00" : "FF0000",
$status ? "PASSED!" : "FAILED!");
?>
相关阅读 更多 +