最后五页使用php + jquery访问Cookie [英] Last Five Pages Visited Cookie with php+jquery
本文介绍了最后五页使用php + jquery访问Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何显示最后五页使用php jquery访问Cookie
how to show Last Five Pages Visited Cookie with php jquery.
推荐答案
而不是使用PHP和jQuery,仅用PHP完成:
Instead of using PHP and jQuery, this can be accomplished solely with PHP:
session_start();
if(empty($_SESSION['history']))
$_SESSION['history'] = array($_SERVER['PHP_SELF']);
else {
$_SESSION['history'][] = $_SERVER['PHP_SELF'];
if(count($_SESSION['history']) > 5)
array_shift($_SESSION['history']);
}
$ _ SESSION ['history']
将是用户访问过的网址数组,限制为5。
$_SESSION['history']
will be an array of URLs that the user has visited limited to 5.
这篇关于最后五页使用php + jquery访问Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文