我最近在我的电脑上安装了 centos(linux)。我有一段代码,其中 setcookie 函数用于显示消息。它可以在网络中连接的所有其他 Windows 电脑上完美运行。我不知道出了什么问题。是否需要在 linux 的 setcookie 函数中应用任何其他参数?
我应用的代码如下:
setcookie("msg","This record already exist",time()+5,"/");
header("location:".SITE."index.php?page=inventory_sub_categoryfrm);
exit;
并isset($_COOKIE['msg'])
返回假。
Http 标头:
Request URL:http://192.168.1.39/ems/abc.php
Request Method:GET
Status Code:200 OK
Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:PHPSESSID=8q10m0jc8c49eneo924udm2093
Host:192.168.1.39
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.31 (KHTML, like Gecko)
Chrome/26.0.1410.64 Safari/537.31
Response Headers
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Type:text/html; charset=UTF-8
Date:Thu, 23 May 2013 10:00:09 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:Apache/2.2.15 (CentOS)
Transfer-Encoding:chunked
X-Powered-By:PHP/5.5.0RC1