简单的cookie计数器实现源码

yipeiwu_com5年前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实现将标点符号正则替换为空格的方法

本文实例讲述了PHP实现将标点符号正则替换为空格的方法。分享给大家供大家参考,具体如下: <?php $character = "!@#$%^&*中'文中'文中'文()...

php trim 去除空字符的定义与语法介绍

定义和用法 trim() 函数从字符串的两端删除空白字符和其他预定义字符。 语法 trim(string,charlist)参数 描述 string 必需。规定要检查的字符串。 char...

php进程(线程)通信基础之System V共享内存简单实例分析

php进程(线程)通信基础之System V共享内存简单实例分析

本文实例讲述了php进程(线程)通信基础之System V共享内存。分享给大家供大家参考,具体如下: PHP默认情况没有开启功能,要支持该功能在编译PHP的时候要加入下面几个选项&nbs...

php中函数前加&符号的作用分解

php变量前面加&符号是什么意思就不用多说了,大家都在用,就是两个变量同时指向一个地址而已,那么,php函数前面加&符号的意义又是什么呢?下面先上两个演示代码,然后再做解释。 fun...

php使用高斯算法实现图片的模糊处理功能示例

php使用高斯算法实现图片的模糊处理功能示例

本文实例讲述了php使用高斯算法实现图片的模糊处理功能。分享给大家供大家参考,具体如下: <?php class image_blur{ function gau...