search
Homephp教程php手册php简单日历实现程序代码

php简单日历实现程序代码

Jun 13, 2016 am 09:51 AM
phpNocodeaboutblogexistaccomplishapplicationcalendarindependentofprogramSimpleable

关于日历的应用,应该在独立博客上面能很好的体现出来吧,不管是 php 的 wp 博客,还是 ASP 的 z_blog 博客,都应用了日历的功能,那就是日志存档了,在我们要看以前发布的日志时,只要调出日志存档,便能够很清晰的查看每一篇文章了。

因为最近在写一个日历的项目功能,所以自然而然想到了日志的存档,其实实现这样的功能也不是很难,首先要有一个日历的表单来直观显示日历,而处理日期的时间就交给了编程代码,比如PHP,对于要看之前写的文档,也就是将日历向前翻,那么就需要提交日历时间了,然后再交给表单来显示出来。

效果

下面是一个新手做的PHP日历功能,这里用一个文件将日历的功能给写出来了,文件不是很大,有注释,是一个简单的原理功能,接受部分都是由PHP来处理的,显示部分用的是表格,如果做PHP的日历项目可以直接进行二次开发即可使用。

 代码如下 复制代码

 

//剥离日期
date_default_timezone_set("Asia/Harbin");
$riqi=getdate();
$nian=$riqi['year'];
$yue=$riqi['mon'];
$ri=$riqi['mday'];
$hour=$riqi['hours'];
$min=$riqi['minutes'];
$miao=$riqi['seconds'];
//表单判断
if(isset($_GET["yue"])){
 $yue=intval($_GET["yue"]);
}
if(isset($_GET["nian"])){
 $nian=intval($_GET["nian"]);
}
//一个月几天
$tianshu=date('t',mktime(0,0,0,$yue,1,$nian));
//月份第一天周几
$yuez=date('w',mktime(0,0,0,$yue,1,$nian));
$tian=0;
?>


 
  
 
  
 

   
    
     
    
    
     
      
      
      
      
      
      
      
     
    
    
     
      
      
       
      
      
     
    
   
日历 现在时间:
" align="center">
                  if($h*$l           echo ' ';
         }elseif($tian           echo ++$tian;       
         }else{
          echo ' ';
         }
        ?>
       

  

   上一年
   下一年
   
    
    
            if($yue-1        echo '        }else{
       echo '       }
     ?>月
    

    
    
            if($yue+1>12){
       echo '1';
      }else{
       echo $yue+1;
      }?>月>
    

   
   

    

年:


    

月:


    
   

  
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools