Introducing a code written in PHP to count website visits. The data is saved in the local file count3.dat and called with js in the page. Friends in need can refer to it.
1. Statistics page count.php <?php /** * 网站访问统计 * edit bbs.it-home.org */ function pageVisitCount(){ $count= "count3.dat"; $num= @file_get_contents($count); if ($fp= fopen($count,"w+")){ flock($fp,LOCK_EX); $num++; fwrite($fp,$num); flock($fp,LOCK_UN); } return $num; } echo pageVisitCount(); ?> Copy after login 2. Page call Copy after login |