国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

非常簡單的日歷類

2024-09-04 11:44:00
字體:
來源:轉載
供稿:網友
  1. date_default_timezone_set("etc/gmt-8"); 
  2. class calendar{ 
  3. var $t = array(); 
  4. var $datesofmonth = array('1'=>'31','2'=>'28','3'=>'31','4'=>'30','5'=>'31','6'=>'30','7'=>'31','8'=>'31','9'=>'30','10'=>'31','11'=>'30','12'=>'31'); 
  5. var $y,$m,$d
  6. function set($time){ 
  7. $this->t = getdate($time); 
  8. $this->y = $this->t['year']; 
  9. $this->m = $this->t['mon']; 
  10. $this->d = date('d',$time); 
  11. function isrun(){ 
  12. return ($this->y%400==0 || ($this->y%4==0 && $this->y%100==0)) ? 1 : 0; 
  13. function first(){ 
  14. $time = mktime(0,0,0,$this->m,1,$this->y); 
  15. $time = getdate($time); 
  16. return $time['wday']; 
  17. function html(){ 
  18. $isrun = $this->isrun(); 
  19. $this->datesofmonth[2] = $isrun==1 ? 29: 28; 
  20. $html .= "<table style='border:solid 1px black;'>n"
  21. $html .= "<tr><th><a href=''>上一月</a></th><th colspan='5'>{$this->y}年 {$this->m}月</th><th><a href=''>下一月</a></th><tr>n"
  22. $html .= "<tr><td>星期天</td><td>星期一</td><td>星期二</td>111cn.net<td>星期三</td><td>星期四</td><td>星期五</td><td>星期六</td></tr>n"
  23. $html .= "<tr>n"
  24. $first = $this->first(); 
  25. for($i=0; $i<$first$i++){ 
  26. $html .= "<td></td>"
  27. $count = $this->datesofmonth[$this->m]+$first
  28. for ($i=1; $i<= $this->datesofmonth[$this->m]; $i++){ 
  29. $style = $i==$this->d ? ' style="color:red;font-weight:bold;"' : '' ; 
  30. $html .= "<td align='center'{$style}>$i</td>"
  31. if (($i==7%$first || ($i+$first)%7==0) && $i<$count){ 
  32. $html .= "</tr>n<tr>"
  33. $count = 7-$count%7; 
  34. if ($count<7){ 
  35. for ($i=0; $i<$count$i++){ 
  36. $html .= "<td></td>"
  37. $html .= "</tr>n"
  38. $html .= "</table>n"
  39. return $html
  40. $calendar = new calendar(); 
  41. $calendar->set(time()); 
  42. echo $calendar->html(); 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临泽县| 馆陶县| 丹棱县| 桓仁| 山阳县| 会理县| 宁城县| 桃江县| 南昌县| 富川| 灌南县| 汉川市| 镇宁| 大方县| 灌阳县| 武山县| 察哈| 资中县| 江山市| 平乡县| 泾源县| 佛冈县| 昌江| 虞城县| 泽普县| 雅江县| 峨山| 黔东| 都兰县| 麟游县| 金秀| 元阳县| 新津县| 西林县| 上杭县| 合作市| 黄山市| 桃江县| 邵阳县| 丁青县| 云龙县|