Copy CodeThe code is as follows:
$monthoneday =date ("Ym"). " 01 ";
$oneweekday =date ("W", Strtotime ($monthoneday)); Get 1th Week of the month
$monthday =date ("T"); How many days this month
$startlow = ($oneweekday ==0)? 7: $oneweekday; Starting from the first few columns
For ($a =1, $b = $startlow; $a <= $monthday; $a + +, $b + +) {
$ary [$b]= $a; Control where the date is output with an array
}
$c = 1;
The number of output lines equals the number of days in the month except 7 rounding plus 1
for ($a =1; $a <= (int) ($monthday/7) +1; $a + +) {
echo "";
I use the array key to control where I output
for ($b =1; $b <=7; $b + +, $c + +) {
if ($ary [$c]==date ("J")) {
Echo '';
}else{
echo "";
}
echo $ary [$c];
echo "";
echo "\ n";
}
echo "";
}
?>
The writing estimate is not the same as others. Oh... In this process I wrote for a long time, just beginning has been the circulation of ideas have a problem. Actually output 31 line 1234 Ah ...
It seems that only a lot of writing to practice thinking ... This should be implemented with JS, but I will not JS ... It's the only way.
Here are the effects ... The main template is very good-looking ...
http://www.bkjia.com/PHPjc/320737.html www.bkjia.com true http://www.bkjia.com/PHPjc/320737.html techarticle Copy the code as follows: PHP $monthoneday =date ("Ym"). " 01 "; $oneweekday =date ("W", Strtotime ($monthoneday)); Get a few $monthday =date ("T") on the week of 1th this month; How many days this month $sta ...