<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQT</title>
<style>div{ width:300px;height:400px; background:#CFF; padding:20px}</style>
</head>
<?php
//用于测试的文档
$all_data = array(
1 => array('1:标题1','内容1……'),
2 => array('2:标题2','内容2……'),
3 => array('3:标题3','内容3……'),
4 => array('4:标题4','内容4……'),
);
$id=isset($_GET['id'])?$_GET['id']:1;
//判断有无设置action
$action = isset($_GET['action'])?$_GET['action']:$id;
if($action=='clear'){
//清空cookie
setcookie('history','',time()-3600);
//数组清空
$his=array();
}else{
if(!isset($_COOKIE['history'])){
$his[]=$id;
}else{
$his=explode('|',$_COOKIE[&
php简单实现cookie的历史记录及清除历史记录功能
最新推荐文章于 2021-04-11 08:37:14 发布