php开发网站访问历史记录功能主要利用的php的$_Cookie函数,在访问页面的时候我们就创建一个COOKIE。setcookie("h5uc_history", "1", time() + 3600);
print_r($_COOKIE);
然后在需要调用的地方读取$_COOKIE里面的信息id,在查询对应的信息内容。
$history=$_COOKIE['h5uc_history'];
$d_record=explode(",",$history);
for($i=0;$i<50;$i++)
{
if ($d_record[$i]){
$cr=$empire->fetch1("select id,title,titlepic,classid from {$dbtbpre}ecms_h5 where id='$d_record[$i]' limit 1");
$url=$public_r['add_www_11px_cn_www']."/game-".$cr[id].".html";
?>
最后输出出来
" target="_blank" title="=$cr['title']?>">
" alt="=$cr['title']?>"/>
=$cr['title']?>
}}?>