PHP Simple Calendar Implementation Code _php tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.