项目需求:统计用户所停留页面的时长
public function tongji()
{
$data = DB::table('tongji')
->select('page', DB::raw('SUM(staytime) as staytime'))
->groupBy('page')
->get();
return $data;
}
注意一定要引入 use Illuminate\Support\Facades\DB;
否则会报错
评论 (0)