php中博客日曆實作程式碼

高洛峰
發布: 2016-11-29 15:56:03
原創
1014 人瀏覽過

分享一款php中博客日曆實現代碼,裡面有一句是查詢數據庫的這個很簡單,只要你修改一下字段名與你數據庫相同就行了,實例代碼如下:

function calendarnew($starttime = 0) {

 

global $db, $tablepre, $timestamp, $site_timeoffset, $site_dateformat, $curtime; 

 $

$curtime = gmdate($site_dateformat, $ starttime + $timeoffset * 3600); 

 

$pendtime = $starttime - (gmdate('j. $timeoffset * 3600) % 86400 ; 

 

$pstarttime = $pendtime - gmdate('t', $pendtime + $timeoffset * 3600  + gmdate('t', $pendtime + $ timeoffset * 3600 + 1) * 86400; 

$nendtime = $nstarttime + gmdate('t', $nstarttime + skip, $dim) = explode(' -', gmdate('w-t', $pendtime + $timeoffset * 3600 + 1)); 

 

🎇 ); 

 

$query = $db->query("SELECT dateline FROM {$tablepre}vitaitems WHERE dateline BETWEENof$ ($blog = $db ->fetch_array($query)) { 

 

$day = gmdate('j', $blog['dateline'] + $timeoffset  3600)); ? $blogs[$day] = array('num' => 1, 'dateline' => $blog['dateline'] - $blog['dateline'] % 86400) : $blog$blog['dateline'] % 86400) : $blog$blog['dateline'] % 86400) : $blog$blogs[$day]['numnum ']++; 

$cal = ''; 

for($row = 0; $row '; 

for($col = 0; $col $cur =  * 7 + $col  $dim ? ' ' : $cur; 

if(!isset($blogs[$cur $curtd.''; 

} else { 

$cal .= '.$uid.'&starttime=' .$blogs[$cur]['dateline'].'&endtime='.($blogs[$cur]['dateline'] + 86400).'" title=" '.$blogs[$cur]['num '].' ">'.$cur.''; 

$cal .= ''; return

$cal .= ''; return $cal; 

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!