ThinkPHP6 查询 一个月内 每天用户登录情况

  • Post author:
  • Post category:php

统计用户每天登录次数,今天往前30天即:


        $start_time = strtotime('-1 month',time());
       

 格式化(时间戳格式化为普通时间格式)时间 即可取得当天内的数

        $where= [];
        $start_time = strtotime('-1 month',time());
        $end_time = time();
        $where[]=['create_time','between',[$start_time,$end_time]];
        $data = Db::name('user_login')->field('FROM_UNIXTIME(create_time,"%Y-%m-%d") as c_time,count(id) as total')->where($where)->group('c_time')->select();


版权声明:本文为u014538997原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。