一个PHP日历程序_PHP教程

WBOY
Freigeben: 2016-07-21 15:59:33
Original
783 Leute haben es durchsucht

// 
if($HTTP_GET_VARS[year]=="") 

    $HTTP_GET_VARS[year]=date("Y"); 

if($HTTP_GET_VARS[month]=="") 

    $HTTP_GET_VARS[month]=date("n"); 

$month=$HTTP_GET_VARS[month]; 
$year=$HTTP_GET_VARS[year]; 
// 
if($year{ 
    echo "出错!"; 
    echo "
"; 
    echo "Back"; 
    exit(); 

?> 

 
 
  
$d=date("d"); 
$FirstDay=date("w",mktime(0,0,0,$month,1,$year));//取得任何一个月的一号是星期几,用于计算一号是由表格的第几格开始 
$bgtoday=date("d"); 
function font_color($month,$today,$year)//用于计算星期天的字体颜色 

    $sunday=date("w",mktime(0,0,0,$month,$today,$year)); 
    if($sunday=="0") 
    { 
        $FontColor="red"; 
    } 
    else 
    { 
        $FontColor="black"; 
    } 
    return $FontColor; 

function bgcolor($month,$bgtoday,$today_i,$year)//用于计算当日的背景颜色 

    $show_today=date("d",mktime(0,0,0,$month,$today_i,$year)); 
    $sys_today=date("d",mktime(0,0,0,$month,$bgtoday,$year)); 
    if($show_today==$sys_today) 
    { 
        $bgcolor="bgcolor=#6699FF"; 
    } 
    else 
    { 
        $bgcolor=""; 
    } 
    return $bgcolor; 

function font_style($month,$today,$year)//用于计算星期天的字体风格 

    $sunday=date("w",mktime(0,0,0,$month,$today,$year)); 
    if($sunday=="0") 
    { 
        $FontStyle=""; 
    } 
    else 
    { 
        $Font; 
    } 
    return $FontStyle; 

for($i=0;$i{ 
    for($i;$i    { 
        echo "
\n"; 
    } 
    if($i==$FirstDay) 
    { 
        echo "
\n"; 
        if($FirstDay==6)//判断1号是否星期六 
        { 
            echo "
"; 
        } 
    } 

$countMonth=date("t",mktime(0,0,0,$month,1,$year));//某月的总天数 
for($i=2;$i{ 
    echo "\n"; 
    if(date("w",mktime(0,0,0,$month,$i,$year))==6)//判断该日是否星期六 
    { 
    echo "\n"; 
    } 

?> 
 
// 
if($month{ 
    $month=12; 
    $year-=1; 

if($month>12) 

    $month=1; 
    $year+=1; 

// 
//*************************************** 
// 
echo ">>"; 
?> 
 
 
echo ">>"; 
// 
   ?>
 ".font_style($month,1,$year)."1
".font_style($month,$i,$year)."$i


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/317347.htmlTechArticle?php //-------处理通过GET方法提交的变量;开始-------- if($HTTP_GET_VARS[year]=="") { $HTTP_GET_VARS[year]=date("Y"); } if($HTTP_GET_VARS[month]=="") { $HTTP_GET_VARS[mon...
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 Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!