<?php //Calculate 60 days in the future //seconds * minutes * hours * days + current time $intime = 30 + time(); // 30秒缓存 if(isset($_COOKIE['lastVisit'])) { $visit = $_COOKIE['lastVisit'] + 1; } else { $visit = "0"; } setcookie("lastVisit",$visit, $intime); echo "Your last visit was - ". $visit; ?>
摘自:http://www.oschina.net/code/snippet_943797_19993