PHP 달력 만들기.

it/PHP 2016. 8. 26. 16:44 Posted by 하얀나다




<?php


print "<h1>" .date("F"). "</h1>";


print "Today:" .date("y/m/d"). "  ".date(l);




print "<br>";

print "<br>";


$arr_day = array("월","화","수","목","금","토","일");

print "<table border=1><tr>";


foreach($arr_day as $value){

print "<th>" .$value. "</th>";

}

print "</tr><tr>";


for($i=0;$i<date("t");$i++){

$week_num = date("w",mktime(0,0,0,date("n"),$i+1, date("Y")));


if($i==0){

print "<tr>";

space($week_num);

}

elseif($week_num == 0){

print "<tr>";

}


if($week_num == 5){

print "<Td><font color = blue>".($i+1)."</font></td>";

}elseif($week_num == 6){

print "<Td><font color = red>".($i+1)."</font></td>";

}else{

print "<Td>".($i+1)."</td>";

}

    

if($i+1 == date("t")){

space(6-$week_num);

print "</tr>";

}

elseif($week_num == 6){

print "</tr>";

}

}


print "</table>";

function space($count){

if($count !=0){

for($i=0;$i<$count;$i++){

print "<td></td>";

}

}

}

'it > PHP' 카테고리의 다른 글

date 매개변수 값.  (0) 2016.08.26
php 설치에서 서버 돌리기까지.  (1) 2016.08.26