成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

使用PHP編寫一個(gè)簡(jiǎn)單的日歷類-創(chuàng)新互聯(lián)

今天就跟大家聊聊有關(guān)使用PHP編寫一個(gè)簡(jiǎn)單的日歷類,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)與策劃設(shè)計(jì),渭源網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10多年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:渭源等地區(qū)。渭源做網(wǎng)站價(jià)格咨詢:028-86922220

具體實(shí)現(xiàn)代碼如下:


date_default_timezone_set("etc/gmt-8");
header("Content-type: text/html; charset=utf-8");
class calendar{
var $t = array();
var $datesofmonth = array('1'=>'31','2'=>'28','3'=>'31','4'=>'30','5'=>'31','6'=>'30','7'=>'31','8'=>'31','9'=>'30','10'=>'31','11'=>'30','12'=>'31');
var $y,$m,$d;
function set($time){
$this->t = getdate($time);
$this->y = $this->t['year'];
$this->m = $this->t['mon'];
$this->d = date('d',$time);
}
function isrun(){
return ($this->y%400==0 || ($this->y%4==0 && $this->y%100==0)) ? 1 : 0;
}
function first(){
$time = mktime(0,0,0,$this->m,1,$this->y);
$time = getdate($time);
return $time['wday'];
}
function html(){
$isrun = $this->isrun();
$this->datesofmonth[2] = $isrun==1 ? 29: 28;
$html .= "<table style='border:solid 1px black;'>n";
$html .= "<tr><th><a href=''>上一月</a></th><th colspan='5'>{$this->y}年 {$this->m}月</th><th><a href=''>下一月</a></th><tr>n";
$html .= "<tr><td>星期天</td><td>星期一</td><td>星期二</td>jb51.net<td>星期三</td><td>星期四</td><td>星期五</td><td>星期六</td></tr>n";
$html .= "<tr>n";
$first = $this->first();
for($i=0; $i<$first; $i++){
$html .= "<td></td>";
}
$count = $this->datesofmonth[$this->m]+$first;
for ($i=1; $i<= $this->datesofmonth[$this->m]; $i++){
$style = $i==$this->d ? ' ' : '' ;
$html .= "<td align='center'{$style}>$i</td>";
if (($i==7%$first || ($i+$first)%7==0) && $i<$count){
$html .= "</tr>n<tr>";
}
}
$count = 7-$count%7;
if ($count<7){
for ($i=0; $i<$count; $i++){
$html .= "<td></td>";
}
}
$html .= "</tr>n";
$html .= "</table>n";
return $html;
}
}
$calendar = new calendar();
$calendar->set(time());
echo $calendar->html();

看完上述內(nèi)容,你們對(duì)使用PHP編寫一個(gè)簡(jiǎn)單的日歷類有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。

當(dāng)前名稱:使用PHP編寫一個(gè)簡(jiǎn)單的日歷類-創(chuàng)新互聯(lián)
本文網(wǎng)址:http://jinyejixie.com/article4/jgsoe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、關(guān)鍵詞優(yōu)化外貿(mào)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)公司、靜態(tài)網(wǎng)站小程序開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
昌黎县| 福泉市| 特克斯县| 泊头市| 洛阳市| 贺兰县| 左权县| 华容县| 平湖市| 清徐县| 宁强县| 大田县| 莫力| 栖霞市| 锡林郭勒盟| 浦江县| 临洮县| 鹿邑县| 清水县| 江都市| 宁阳县| 资源县| 高陵县| 台湾省| 岫岩| 太仆寺旗| 甘德县| 昌吉市| 皋兰县| 博湖县| 迭部县| 富平县| 长武县| 平乐县| 巫山县| 象山县| 新疆| 绵竹市| 连平县| 安阳市| 太保市|