ThinkPHP6 query user login status every day within a month

Count the number of daily logins of users, 30 days before today:


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

 Format (the timestamp is formatted as a normal time format) time to get the data of the day

        $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();

Guess you like

Origin blog.csdn.net/u014538997/article/details/126351560