zoukankan      html  css  js  c++  java
  • destoon系统开发-最新利用浏览器的cookie 做历史浏览记录

      注意: 代码 放在要显示的为 (一般放在详情页),注意本教程不入库,直接利用浏览器的 cookie 缓存判断

      

    <!--历史浏览记录 S-->
        <div class="column_box mt_10">
        <div class="column_title">历史浏览记录</div>
        <div class="box_body_new">
    <?php
    $MOD_name = "$MOD[moduledir]";
    if (!empty($_cookie["$MOD_name"]['history'])){
    $history = explode(',', $_cookie["$MOD_name"]['history']);
    array_unshift($history, $itemid);
    $history = array_unique($history);
    while (count($history) > 8){
    array_pop($history);
    }setcookie("$MOD_name".'[history]', implode(',', $history), time() + 86400 * 7,'/'."$MOD_name","$DT_PATH");
    } else {
    setcookie("$MOD_name".'[history]', $itemid, time() + 86400 * 7,'/'."$MOD_name","$DT_PATH");
    } $history =isset ($_cookie["$MOD_name"]['history']) ? $_cookie["$MOD_name"]['history'] : 0;
    if($del=="del"){
    setcookie("$MOD_name".'[history]', "", time()-3600);
    echo header("Location: $linkurl"); 
    };
    $query = mysql_query("SELECt * FROM $table WHERe itemid in ($history) ORDER BY FIELD(itemid,$history)");
    while($t = mysql_fetch_array($query)){?>
    <li><a href="{$t[linkurl]}" title="{$t[alt]}" target="_blank">{$t[title]}</a></li>
     <?php } ?>
        </div>
      </div>
    <!--历史浏览记录 END-->
    

      好了,可以测试了,演示地址:圆柱模板

  • 相关阅读:
    字在线中
    关于页面显示层叠问题
    左边竖条
    jquery 动态添加元素事件绑定问题
    工作总结
    多文本输入,内容过多时输入框会自动撑开
    lunix常用命令
    springboot整合es availableProcessors is already set to [2], rejecting [2]
    mysql 主从复制架构
    elastic search 第一次安装 报错记录
  • 原文地址:https://www.cnblogs.com/68xi/p/8546704.html
Copyright © 2011-2022 走看看