bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

PHP怎么實(shí)現(xiàn)輸出日歷表-創(chuàng)新互聯(lián)

這篇文章主要講解了“PHP怎么實(shí)現(xiàn)輸出日歷表”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“PHP怎么實(shí)現(xiàn)輸出日歷表”吧!

創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的元江縣網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/tupian/20230522/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>月歷表</title>
<?php
 $MONTH = array("元月","一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
 $enMONTH = array("元月","January" ,"February" ,"Marcy" ,"April" ,"May" ,"June" ,"July" ,"August" ,"September" ,"October" ,"November" ,"December");
 $WEEK = array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
 $BACKCOLOR = array("#FFC" , "#FFF" , "#9F6" , "#FFC" , "#6F0" , "#6F6" , "#F90" , "#F06" , "#F00" , "#FC3" , "#FF6" , "#F99");
 
 function PrintMon($year, $mon)
 {
 date_default_timezone_set("Asia/Shanghai"); 
 global $MONTH;
 global $enMONTH;
 global $WEEK;
 global $BACKCOLOR;
 
 $startdate =strtotime("1 $enMONTH[$mon] $year"); //獲取查詢的年月
 $enddate = strtotime("+1 month",$startdate);   //獲取下一個(gè)月的開始日期作為月歷輸出的截止時(shí)間
 $theDate = getdate($startdate); //把日期轉(zhuǎn)化為字符串格式
 $color = $BACKCOLOR[$mon]; //設(shè)置月歷的背景顏色
 
 echo("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"$color\">");
 $ym = $year . "年". $MONTH[$mon];
 echo("<caption><h2>$ym</h2></caption>");
 echo("<tr>");
 for ($i=0; $i<7; $i++) //輸出星期幾
 {
 echo("<td width=\"90\", height=\"40\" align=\"center\" >");
 echo("<h3>$WEEK[$i]</h3>");
 echo("</td>");
 }
 echo("</tr>");


 $theWeek = $theDate[wday];//判斷當(dāng)天是星期幾
 for ($i=0; $i<6; $i++)
 {
 echo("<tr>");
 for ($j=0; $j<7; $j++)
 {
 echo("<td width=\"90\", height=\"40\" align=\"center\" >");
 if ($startdate < $enddate && $theWeek == $j)//把日期輸出到對(duì)應(yīng)的星期幾所在列,并注意不要超出本月日期
 {
 $theDay = $theDate[mday];
 echo("<h3>$theDay</h3>");
 $startdate = strtotime("+1 day", $startdate); //日期前移1天
 $theDate = getdate($startdate);//更新日期
 $theWeek = ($theWeek + 1) % 7;//更新星期
 }
 echo("</td>");
 }
 echo("</tr>");
 if ($startdate == $enddate) //如果已經(jīng)輸出全部日期,結(jié)束循環(huán)
 {
 $i = 6;
 }
 }
 
 echo("</table");
 } 
?>


</head>


<body>


<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<h2>請(qǐng)輸入要查看的年號(hào)和月份(查詢范圍為1970年1月1日至2038年)</h2>
<input type="text" name="myYear">年<input type="text" name="myMonth">月
<input type="submit">
</form>


<?php
 $year = $_POST['myYear']; 
 $month = $_POST['myMonth'];
 if (is_numeric($year) && $year >= 1970 && $year <2038)
 {
 if (is_numeric($month) && $month >= 1 && $month <=12)
 {
 PrintMon($year, $month);
 }
 else if($month != NULL)
 {
 echo("月份不對(duì)" . "<br />");
 }
 }
 else if($year != NULL)
 {
 echo("年份不對(duì)" . "<br />");
 }
?>


</body>
</html>

感謝各位的閱讀,以上就是“PHP怎么實(shí)現(xiàn)輸出日歷表”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)PHP怎么實(shí)現(xiàn)輸出日歷表這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

本文題目:PHP怎么實(shí)現(xiàn)輸出日歷表-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://vcdvsql.cn/article26/ddjsjg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google搜索引擎優(yōu)化網(wǎng)頁(yè)設(shè)計(jì)公司品牌網(wǎng)站制作網(wǎng)站維護(hù)外貿(mào)建站

廣告

聲明:本網(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í)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)