Php allows you to count the number of online users of a website. Php: how to count the number of online users of a website. This document describes how to count the number of online users of a website in php. Share it with you for your reference. The specific implementation method is as follows:
This example describes how to use php to count the number of online users of a website. Share it with you for your reference. The specific implementation method is as follows:
$val) { $val= trim($val); if ($val != "") { list($when, $seti) = explode("\t", $val); if ($seti ==$ip) { $arr[$key] = $time . "\t" . $seti; $flag = 1; } else { $currentTime = time(); if ($currentTime - $when > 900) { unset($arr[$key]); }else{ $arr[$key]=$val; } } } } if ($flag == 0) { array_push($arr, $time . "\t" . $ip); } $count = count($arr); $str = implode("\r\n", $arr); $str.="\r\n"; writeover($fileCount, $str, 'w', 0); unset($arr); } return $count;} $time = time();$ip = getIpAddress();$online_num = count_online_num($time,$ip);echo $online_num;?>
The above is the php method for counting the number of online users of the website. The php online number _ PHP Tutorial content. For more information, see PHP Chinese website (www.php1.cn )!
Examples in this article describes how php can calculate the number of online users of a website. Share it with you for your reference. The specific implementation method is as follows...