理论上不分CMS与什么框架的。前提是要安装workerman. 以帝国CMS为例。非帝国CMS的把帝国的引用文件删除即可 [ol]zAdd('online_users_tongji', time(), $userIdentifier);}function countOnlineUsers() {global $redis;return $redis->zCard('online_users_tongji');}function recordPageVisit($pageUrl) {global $redis;$redis->incr('page_visits_tongji:'. $pageUrl);}function cleanExpiredOnlineUsers() {global $redis;$expiredTime = time() - 60;$redis->zRemRangeByScore('online_users_tongji', 0, $expiredTime);}function getPageVisits($pageUrl) {global $redis;return (int) $redis->get('page_visits_tongji:'. $pageUrl);}$userIdentifier = uniqid(); recordOnlineUser($userIdentifier);$pageUrl = $_SERVER['REQUEST_URI']; recordPageVisit($pageUrl);$onlineCount = countOnlineUsers();$pageVisitCount = getPageVisits($pageUrl); $req_data['content']="当前在线人数:{$onlineCount},访问量:{$pageVisitCount}";$req_data['pageUrl']=$pageUrl;$req_data['onlineCount']=$onlineCount;$req_data['pageVisitCount']=$pageVisitCount;cleanExpiredOnlineUsers();$req_data['type'] = 'tongji_all';Gateway::sendToAll($req_data['content']);[/ol]复制代码 帝国, 访问量