요일구하기에서
본문
<?php $week = date ("w", strtotime($R['sdate']));
};
case ("0") : $nm_week = "일"; break;
case ("1") : $nm_week = "월"; break;
case ("2") : $nm_week = "화"; break;
case ("3") : $nm_week = "수"; break;
case ("4") : $nm_week = "목"; break;
case ("5") : $nm_week = "금"; break;
case ("6") : $nm_week = "토"; break;
default :
};
echo $nm_week;?>
여기서 토일은 빨간색으로 표시할려고하는데 어떻게 하면 되나요
답변 1
<?php
$week = date ("w", strtotime($R['sdate']));
switch($week){
case 0 :$nm_week = "일"; break;
case 1 : $nm_week = "월"; break;
case 2 : $nm_week = "화"; break;
case 3 : $nm_week = "수"; break;
case 4 : $nm_week = "목"; break;
case 5 : $nm_week = "금"; break;
case 6 : $nm_week = "토"; break;
default : "에러발생! 값이 잘못넘어왔으니 알아서해!";
}
if($week == "토") echo "<font color='red'>".$nm_week."</font>";
else echo $nm_week;
?>