Heim > php教程 > php手册 > PHP实现的简单日历代码

PHP实现的简单日历代码

WBOY
Freigeben: 2016-06-21 09:06:19
Original
933 Leute haben es durchsucht

日历

//calendar.php

                                                                         
 /*******************************                                          
  *   用来判断是否闰年的函数    *                                          
  *   可以根据更复杂的算法改进  *                                          
  *******************************/                                         
  function leap_year($year)                                                
    {                                                                 
      if($year% 4 == 0) // basic rule                                      
            {                                                              
             return true; // is leap year                                  
            }                                                              
   else                                                                  
     {                                                                   
      return false;                                                      
     }                                                                   
    }                                                                      
                                                                           
 /*******************************                                          
  *   对一些变量进行赋值操作    *                                          
  *   特别注意对二月份的赋值    *                                          
  *******************************/                                         
  function setup()                                                         
   {                                                                       
   global $mon_num;                                                      
   $mon_num=array(31,30,31,30,31,30,31,31,30,31,30,31);                  
     global $mon_name;                                                     
   $mon_name=array("一","二","三","四",                                  
                  "五","六","七","八",                                   
                  "九","十","十一","十二");                              
   if (leap_year($firstday[year])) // basic rule                         
          {                                                                
            $mon_num[1]=29; // is leap year                                
          }                                                                
   else                                                                  
   {                                                                     
     $mon_num[1]=28;                                                     
   }                                                                     
   }                                                                       
                                                                           
 /*******************************                                          
  *   显示表格中的一格          *                                          
  *   显示的内容和颜色可变      *                                          
  *******************************/                                         
        function showline($content,$show_color)                            
        {                                                                  
         $begin_mark = "

";                          
  $begin_mark =$begin_mark."";                   
  $end_mark = "
";                                            
         echo $begin_mark.$content.$end_mark ;                             
        }                                                                  
                                                                           
                                                                           
?>                                                                         
                                                                           
                                                  
                                                                     
                                                                           
                                                                     
                                                                           
                                                                     <br>社区日历                                                                    <br>                                                                    
                                                                           
         
                                                                           
                                                                     
                                                                           
                                                                     
                                                                           
                                                                         
   //
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage