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

统计用户每天登录次数,今天往前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();

猜你喜欢

转载自blog.csdn.net/u014538997/article/details/126351560
今日推荐