DB_select_once("member_reg","`uid`='".$_COOKIE['uid']."' and `usertype`='".$_COOKIE['usertype']."' and `date`='".$date."'"); $arr=array(); $allreg=$db->select_all("member_reg","`uid`='".$_COOKIE['uid']."' and `usertype`='".$_COOKIE['usertype']."' order by `id` desc limit 32"); if($allreg&&is_array($allreg)){ $alldate=array(); foreach($allreg as $val){ $alldate[]=$val['date']; } } $date=date("Ymd"); $year=date('Y'); $month=date('m'); if($month>12){ $month=1; $year+=1; } $currentDate=$year."年".$month."月";//当前得到的日期信息 $days = date("t",mktime(0,0,0,$month,1,$year));//得到给定的月份应有的天数 $dayofweek = date("w",mktime(0,0,0,$month,1,$year));//得到给定的月份的 1号 是星期几 if($reg['id']){ $ahtml='已签到'; }else{ $ahtml='签到'; } $html='
日 | 一 | 二 | 三 | 四 | 五 | 六 |
---|---|---|---|---|---|---|
"; } for ($i=1;$i<=$days;$i++){//输出天数信息 if($i<10){ $ndays=$year.$month.str_pad($i,2,'0',STR_PAD_LEFT); }else{ $ndays=$year.$month.$i; } if(in_array($ndays,$alldate)){ $class='on'; }else{$class='';} if ($nums%7==0){//换行处理:7个一行 $html.=' | '.$i.' | |||||
'.$i.' | '; } $nums++; } $html.="