Home> php教程> PHP源码> body text

php月历类

PHP中文网
Release: 2016-05-25 17:06:47
Original
1163 people have browsed it

1. [文件] php月历类

    _CurrMon= isset($_GET['mon'])?$_GET['mon']: date('n'); $this->_MonNum=array(31,30,31,30,31,30,31,31,30,31,30,31); $this->_WeekNum=array('日','一','二','三','四','五','六'); $this->_url= $this->GetUrl(); $this->_FirstDay= getdate(mktime(0,0,0, $this->_CurrMon,1, date('Y'))); $this->Two(); $this->_LastDay= $this->_MonNum[$this->_CurrMon-1]; $this->_MonWeekSum= $this->MonWeekSum(); } //返回连接 private function GetUrl(){ $_url=$_SERVER['REQUEST_URI']; $_arr= parse_url($_url); parse_str($_arr['query'],$_QueryArr); unset($_QueryArr['mon']); $_str= http_build_query($_QueryArr); return $_arr['path'].'?'.$_str.'&mon='; } //返回二月份天数 private function Two(){ if(date('L')){ return $this->_MonNum[1]=29; }else{ return $this->_MonNum[1]=28; } } //返回每月的星期数 private function MonWeekSum(){ return ceil(($this->_LastDay+$this->_FirstDay['wday'])/7); } //上月 private function PreMon(){ if($this->_CurrMon>1){ return "_url.($this->_CurrMon-1)."' style='float:left; margin-left:15%;'><<"; } } private function NextMon(){ if($this->_CurrMon<12){ return "_url.($this->_CurrMon+1)."' style='float:right; margin-right:15%;'>>>"; } } //月历 private function Mon(){ echo ""; echo ""; echo ""; foreach ($this->_WeekNum as $_arr1){ echo ""; } echo ""; for($i=0;$i<$this->_MonWeekSum;$i++){ echo ""; for($j=0;$j<7;$j++){ if($this->_FirstDay['wday']>0 || $this->_BiaoJi>$this->_LastDay){ echo ""; $this->_FirstDay['wday']--; }else{ if($this->_BiaoJi==date('j')){ echo ""; }else{ echo ""; } $this->_BiaoJi++; } } echo ""; } echo "
".$this->PreMon().' '.date("Y").' 年 '.$this->_CurrMon.' 月 月历 '.$this->NextMon()."
{$_arr1}
 {$this->_BiaoJi}
阳历".$this->_CurrMon."月".$this->_BiaoJi."号"."
{$this->_BiaoJi}
阳历".$this->_CurrMon."月".$this->_BiaoJi."号"."
"; } public function show(){ if($this->_CurrMon>0 && $this->_CurrMon<=12){ $this->Mon(); }else{ echo '非法操作'; } } } $_calendar=new calendar(); $_calendar->show(); ?>
Copy after login

2. [文件] php月历类 ~ 70KB

php月历类月历.zip


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Recommendations
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!