'1월', 2 => '2월', 3 => '3월', 4 => '4월', 5 => '5월', 6 => '6월',
7 => '7월', 8 => '8월', 9 => '9월', 10 => '10월', 11 => '11월', 12 => '12월'
];
$currentMonth = isset($_GET['month']) ? (int)$_GET['month'] : date('n');
$currentYear = isset($_GET['year']) ? (int)$_GET['year'] : date('Y');
// Adjust month/year if needed
if($currentMonth < 1) {
$currentMonth = 12;
$currentYear--;
} elseif($currentMonth > 12) {
$currentMonth = 1;
$currentYear++;
}
?>
';
echo '
';
echo '| 일 | ';
echo '월 | ';
echo '화 | ';
echo '수 | ';
echo '목 | ';
echo '금 | ';
echo '토 | ';
echo '
';
echo '';
$dayCount = 1;
// Fill empty cells for first week
for($i = 1; $i < $firstDay; $i++) {
echo ' | ';
$dayCount++;
}
// Fill days
for($day = 1; $day <= $daysInMonth; $day++) {
$currentDate = date('Y-m-d', strtotime($currentYear.'-'.$currentMonth.'-'.$day));
$isToday = ($currentDate == date('Y-m-d')) ? 'background: #ff0000; color: #fff; font-weight: bold; border: 2px solid #000;' : '';
echo ''.$day.' | ';
if($dayCount % 7 == 0) {
echo '
';
}
$dayCount++;
}
// Fill remaining empty cells
while($dayCount % 7 != 1) {
echo ' | ';
$dayCount++;
}
echo '
';
echo '';
?>