简单的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>


 

相关文章

mod_php、FastCGI、PHP-FPM等PHP运行方式对比

概述 写这篇文章的是因为今天要Ubuntu下搭建LNMP环境,Nginx使用的是PHP-FPM,所以对Web服务器与PHP解释器的交互方式做了个整理。 众所周知,PHP是跨平台、跨服务器...

php cli 方式 在crotab中运行解决

复制代码 代码如下: /var/www/html/bt/e/BtSys:.:/usr/share/pear:/usr/share/phpPHP Warning: require(../c...

php代码运行时间查看类代码分享

复制代码 代码如下: //date:2011-08-05 class RunTime//页面执行时间类 { private $starttime;//页面开始执行时间 private $...

PHP时间类完整实例(非常实用)

本文实例讲述了PHP时间类。分享给大家供大家参考,具体如下: <?php header("Content-type:text/html;Charset=utf-8");...

php启动时候提示PHP startup的解决方法

php启动时候提示PHP startup的解决方法

最近在学习php,配置好php环境后,每次开机都有警告提示说 PHP startup。如下图: 显然这是个小问题,是关于php配置的。 解决这个问题很简单只需要在php.ini 文件中修...