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