{include file='ebcms@common/header' /}

### 浏览日志 页面统计

##### 今日统计 昨日统计 前日统计 本周统计 上周统计 历史数据

{php} $rows = input('rows', 0, 'intval') ?: 1000; $where = []; $times = input('times'); switch ($times) { case 'lishi': break; case 'zuori': $start = strtotime(date('Y-m-d', time() - 86400)); $end = strtotime(date('Y-m-d')); $where = [ 'create_time' => ['between', [$start, $end]], ]; break; case 'qianri': $start = strtotime(date('Y-m-d', time() - 172800)); $end = strtotime(date('Y-m-d', time() - 86400)); $where = [ 'create_time' => ['between', [$start, $end]], ]; break; case 'benzhou': $date = date('Y-m-d'); $w = date('w', strtotime($date)); $start = strtotime("$date -" . ($w ? $w - 1 : 6) . ' days'); $where = [ 'create_time' => ['between', [$start, time()]], ]; break; case 'shangzhou': $date = date('Y-m-d'); $w = date('w', strtotime($date)); $end = strtotime("$date -" . ($w ? $w - 1 : 6) . ' days'); $start = $end - 7 * 24 * 3600; $where = [ 'create_time' => ['between', [$start, $end]], ]; break; default: $start = strtotime(date('Y-m-d')); $where = [ 'create_time' => ['between', [$start, time()]], ]; break; } $data = \think\Db::name('tongji_tongji')->group('url,title')->where($where)->field('count(*) as num,url,title')->order('num desc')->paginate($rows, true); {/php}

页面 | 访问次数 | 标题
--- | --- | ---
{foreach name='data' item='vo'}
{$vo.url|mb_substr=0,60} | {$vo.num} | {$vo.title|mb_substr=0,30}
{/foreach}

{$data -> render()}
{include file='ebcms@common/footer' /}