-
-
/**
- @统计页面浏览次数 文本缓存
- @site http://bbs.it-home.org
- *
- */
- private function visit($id)
- {
- if (isset($GLOBALS['cfg_safe']['visit-article']) && $GLOBALS['cfg_safe']['visit-article'])
- {
- $file = SYS_PATH . 'cache/visit-article.txt';
-
- if (!file_exists($file))
- {
- file_put_contents($file, ',' . $id);
- }
- else if ((time() - filectime($file)) {
- file_put_contents($file, ',' . $id, FILE_APPEND);
- }
- else
- {
- $string = file_get_contents($file);
- if ($string != '')
- {
- $temp = explode(',', $string);
- foreach ($temp as $row)
- {
- if (empty($row))
- continue;
- $this->mysql->update('UPDATE `pcb_article` SET `visit` = `visit` + 1 WHERE `id` = ' . $row . ' LIMIT 1');
- }
- }
- unlink($file);
- }
- }
- }
复制代码
|