<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> <li>* cookie计数器实例</li> <li>* by bbs.it-home.org</li> <li>* date: 2013-9-29</li> <li>*/</li> <li>if (!isset($_COOKIE['visits'])) $_COOKIE['visits'] = 0;</li> <li>$visits = $_COOKIE['visits'] + 1;</li> <li>setcookie('visits',$visits,time()+3600*24*365);</li> <li>?></li> <li> <li> <li><title> Title </title></li> <li> <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> <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>