Echo all months with days calendar

后端 未结 5 1761
星月不相逢
星月不相逢 2021-02-06 20:12

I am using the code below to echo the current month. How can i enhance it so that is shows all the months with the names and days and dates..

Code:

 &         


        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-06 20:33

    The best answer has an inaccuracy! You should add a condition if year is leap-year BEFORE a cycle, otherwise you will have problems with output of first days of first month see screenshot.

    The necessary condition: date("L", mktime(0,0,0, 7,7, $year)) ? $days = 366 : $days = 365; (if year is leap-year then counter of cycle = 366 else 365)

提交回复
热议问题