zhangjingyu
通过搜索包含“online.php”的文件,在smallcard.php文件里有一段代码值得研究也,和遍历有关。
/**
* 从文件缓存获取用户正在看
*
* @param int $username 用户名
* @return array
*/
function getViewingByFile($username) {
$onlinedb = is_file(D_P.'data/bbscache/online.php') ? openfile(D_P.'data/bbscache/online.php') : array();
if (!$onlinedb) return array();
foreach ($onlinedb as $v) {
if (!trim($v)) continue;
$online = explode("\t",$v);
if ($online[0] == $username) break;
}
return array(
'tid'=> ( isset($online[4]) && $online[4] ) ? $online[4] : '',
'fid'=> ( isset($online[3]) && $online[3] ) ? $online[3] : ''
);
}

