728x90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$year = date('Y'); | |
$month = date('n'); | |
list($week, $last_day) = preg_split('[-]', date('w-t', mktime(0, 0, 1, $month, 1, $year))); | |
?> | |
현재 : <?=$year?>년 <?=$month?>월 | |
<table> | |
<tr> | |
<th>일</th> | |
<th>월</th> | |
<th>화</th> | |
<th>수</th> | |
<th>목</th> | |
<th>금</th> | |
<th>토</th> | |
</tr> | |
<tr> | |
<?php | |
$j = 1; | |
for($i = (1 - $week); $i <= $last_day; $i++) { | |
echo '<td>'.($i > 0 ? $i : '').'</td>'; | |
if($j % 7 == 0) echo '</tr><tr>'; | |
$j++; | |
} | |
?> | |
</tr> | |
</table> |
[샘플]
이전, 다음 없고 아무런 스타일도 없습니다. 나머지는 직접 구현하면 됩니다.
반응형
'Programming > PHP' 카테고리의 다른 글
[정규표현식]연락처에 하이픈 넣기 (0) | 2024.01.30 |
---|---|
PHPMailer로 메일 보낼 때의 오류(smtp.office365.com) (0) | 2023.11.14 |
[Laravel]php artisan schema:dump (0) | 2023.10.20 |
나이스 본인 인증 - 암호화 토큰 발급받기 (0) | 2023.01.17 |
나이스 본인 인증 - access_token 발급받기 (0) | 2023.01.11 |