PHP計算連續簽到天數以及累計簽到天數

2022-07-03 09:12:11 字數 698 閱讀 8945

**如下:

/*

* * 統計連續簽到天數以及累計簽到天數

* @param string $user_long_id 使用者id

* @return array 一維陣列

*/function sign_count($user_long_id)

$count = count($day_list); //

累計簽到天數

}

if($cur_day - 1 > date("

ymd",$day_list[0

]))

else

for($i = 0;$i < $count - 1;$i++)

return array('

add_days

'=>$add_count_days,'

total_day

'=>$count);

}/**

* 比較當天簽到天數與上一次簽到時間

* @param string $curday 當天簽到天數

* @param string $nextday 上一次簽到天數

* @return boolean

*/function compareday($curday,$nextday)

else

}

以上就是這次的全部內容!

mysql 連續簽到天數 最大連續簽到天數 sql

select min rq as 起始日期 max rq as 終止日期 max id1 min id1 1 as 持續天數 id3 as 累計簽到天數 name from select datediff rq,2020 02 01 id1 select count 1 from tmptable ...

sql 得到連續簽到天數及總簽到天數

declare days int set days 0 declare curr day datetime 建立day用於儲存連續簽到日期set curr day getdate curr day為當前日期 while exists select null from mall membersign ...

最大連續簽到天數 sql

select min rq as 起始日期 max rq as 終止日期 max id1 min id1 1 as 持續天數 id3 as 累計簽到天數 name from select datediff rq,2020 02 01 id1 select count 1 from tmptable ...