您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php使用cookie统计访问者登陆次数的代码举例

2024/3/21 18:56:17发布16次查看
复制代码
下面是有关这个例子的代码说明,供大家参考。
以上代码中,首先,浏览器请求一个资源(这个php页面),发送下面的http包头内容到服务器:
get http://localhost/index.php http/1.1host:localhostaccept:*/*accept-language:zh-cnaccept-encoding:gzip,deflateuser-agent:mozilla/4.0 (compatible;msie 6.0;windows nt 5.1;sv1)connection:keep-alive**页程序(index.php)创建了cookie,服务器传输下面的http报头内容到浏览器:
http/1.1 200 okserver:apache/2.2.6 (win32) php/5.2.6date:fri,23 mar 2009 23:15:55 gmtconnection:keep-alivecontent-length:65content-typt:text/htmlset-cookie:visitorcount=1; expires=thr,30-jul-2010 16:00:00 gmt;domain=localhost;path=/cache-control:privateget http://localhost/index.php http/1.1这将在客户端保存一个cookie文件,并保存$c变量,当再次请求时,就会将cookie中的数据传给服务器,例如下边的http请求报头:
accept:*/*accept-language:zh-cnpragma:no-cacheuser-agent:mozilla/4.0(compatible;msie 6.0;windows nt 5.1; sv1)host:localhostconnection:keep-alivecookie:visitorcount=1有了这样的分析,希望有助于大家理解与掌握php中cookie的用法。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product