간단 달력 :_My works_:

$year = date('Y');
$month = date('m');

$time = strtotime($year.'-'.$month.'-01');
list($tday, $sweek) = explode('-', date('t-w', $time));  // 총 일수, 시작요일
$tweek = ceil(($tday + $sweek) / 7);  // 총 주차
$lweek = date('w', strtotime($year.'-'.$month.'-'.$tday));  // 마지막요일

<table width='100%' cellpadding='0' cellspacing='1'>
  <tr>
    <th>일</th>
    <th>월</th>
    <th>화</th>
    <th>수</th>
    <th>목</th>
    <th>금</th>
    <th>토</th>
  </tr>
        
  <? for ($n=1,$i=0; $i<$tweek; $i++){ ?>
  <tr>
    <? for ($k=0; $k<7; $k++){ ?>
    <td>
      <? if (!(($i == 0 && $k < $sweek) || ($i == $tweek-1 && $k > $lweek))){ ?>
        <?=$n++?>
      <? } ?>
    </td>
    <? } ?>
  </tr>
  <? } ?>
</table>

출처
http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=71515&page=1

덧글

댓글 입력 영역