函式:setcookie() |
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 资讯可以到 http://www.netscape.com/newsref/std/cookie_spec.html,由 cookie 原创者 Netscape 所提供的完整资讯。
dante@mpath.com (27-May-1999) 所提供的 setcookie() 及 header() 范例。
|