<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_43848"> <div class="blockcode"> <div id="code_UZM"><ol> <li> <li><?php<li>/**<li>* cookie计数器实例<li>* by bbs.it-home.org<li>* date: 2013-9-29<li>*/<li>if (!isset($_COOKIE['visits'])) $_COOKIE['visits'] = 0;<li>$visits = $_COOKIE['visits'] 1;<li>setcookie('visits',$visits,time() 3600*24*365);<li>?></li> <li><html></li> <li><head></li> <li><title> Title </title></li> <li></head></li> <li><body></li> <li><?php<li>if ($visits > 1) {</li> <li> echo("访问次数:$visits.");</li> <li>} else { // First visit</li> <li> echo('欢迎来到程序员之家,这是你第一次来访。本节介绍的是php cookie实现计数器的方法。');</li> <li>}</li> <li>?></li> <li></body></li> <li></html></li> </ol></div> <em onclick="copycode($('code_UZM'));">复制代码</em> </div> </td></tr></table> <div id="comment_43848" class="cm"> </div> <div id="post_rate_div_43848"></div> <br><br>