search
Homephp教程php手册一个PHP日历程序

一个PHP日历程序

Jun 13, 2016 pm 12:35 PM
gethtphpvariabledeal withstartsubmitmethodcalendarofprogrampass

// 
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


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

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

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.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools