简单的cookie计数器实现源码

yipeiwu_com6年前PHP代码库

复制代码 代码如下:

<?php  if (!empty ($_COOKIE['example'] ))
             $example = ++$_COOKIE['example'] ;
        else $example = 1 ; 
            setcookie("example",$example,time()+54000);
?>

复制代码 代码如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>简单的COOKIE计数器</title>
<style type="text/css">
<!--
.style1 {
    font-size: 14px;
    font-family: "华文琥珀";
}
.style2 {
    font-size: 25px;
    font-family: "华文行楷";
}
.style3 {
    font-size: 13px;
    font-family: "华文琥珀";
}
-->
</style>
</head>
<body>
<table width="350" height="208" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td background="images/136.JPG">
      <table width="240" height="208" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="30" align="center" class="style2"> </td>
      </tr>
      <tr>
        <td height="25" align="center" class="style2">欢迎光临</td>
      </tr>
      <tr>
        <td height="30" align="center" valign="top">
          <span class="style1">本页已经被访问:</span>
          <span class="style2"> <?php echo "$example";?>次</span>
        </td>
      </tr>
      <tr>
        <td height="18" align="center" valign="top">
          <span class="style3">简单的COOKIE计数器</span>
        </td>
      </tr>
      <tr>
        <td height="30" align="center"> </td>
      </tr>
    </table> </td>
  </tr>
</table>
</body>
</html>


 

相关文章

PHP使用NuSOAP调用Web服务的方法

本文实例讲述了PHP使用NuSOAP调用Web服务的方法。分享给大家供大家参考。具体如下: Steps: 1. Download nusoap library from internet...

PHP运行SVN命令显示某用户的文件更新记录的代码

复制代码 代码如下:<?php$user=trim($_GET['user']);$d=$_GET['date'];if(!$d){ $d=date('Ymd',time...

php 多线程上下文中安全写文件实现代码

复制代码 代码如下: <?php /** * @usage: used to offer safe file write operation in multiple threads...

PHP中的use关键字及文件的加载详解

前言 可能在大家经常使用框架,写一个Controller或者Model的时候,写了好多use,但是并没有写文件加载的代码,就以为use可以进行文件的自动加载了。 详细介绍 其实,现在流行...

Could not load type System.ServiceModel.Activation.HttpModule解决办法

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.Service...