简单的cookie计数器实现源码
程序员文章站
2022-10-06 10:29:25
复制代码 代码如下:
<?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 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>
下一篇: python学习之控制流2