国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? php輸出日歷的程序

php輸出日歷的程序

Jun 20, 2016 pm 01:04 PM

最近開發(fā)需求中需要輸出一個日歷,由于該日歷和數(shù)據(jù)庫中的數(shù)據(jù)扯有太多關(guān)系。于是沒有選擇比較常見的用js生成的日歷,而是用php輸出了一個日歷表格。ok,下面將如何用php輸出日歷的程序和大家分享一下。

php輸出的日歷效果如下圖:


具體代碼如下:

<p><?php</p>/*<br />* php 輸出日歷程序<br />*/ <br />header("Content-type: text/html;charset=utf-8");<br />$year=(!isset($_GET['year'])||$_GET['year']=="")?date("Y"):$_GET['year'];<br />$month=(!isset($_GET['month'])||$_GET['month']=="")?date("n"):$_GET['month'];<br />$curUrl=$_SERVER['PHP_SELF'];<br /><br />if($year<1971){<br />	echo "出錯!";<br />	echo "<BR>";<br />	echo "<a href=",$curUrl,">Back</a>";<br />	exit();<br />}<br />?> <br /><table width="200" border="1" cellspacing="0" cellpadding="0" bordercolor="#E7E7E7" style="font-size:12px;" align="center"> <br /><tr align="center"><td colspan="2"> <br /><?php <br />//<-------當(dāng)月份超出1至12時的處理;開始-------> <br />if($month<1){<br />	$month=12;<br />	$year-=1;<br />}<br />if($month>12){<br />	$month=1;<br />	$year+=1;<br />}<br />//<-------當(dāng)月份超出1至12時的處理;結(jié)束-------> <br />//<---------上一年,下一年,上月,下月的連接處理及輸出;開始---------> <br />echo "<a href=",$curUrl,"?year=".($year-1)."&month=".$month."><<</a>年<a href=",$curUrl,"?year=".($year+1)."&month=".$month.">>></a>";<br />?> <br /></td><td colspan="3"><?php echo $year."年".$month."月";?> <br /></td><td colspan="2"> <br /><?php <br />echo "<a href=",$curUrl,"?month=".($month-1)."&year=".$year."><<</a>月<a href=",$curUrl,"?month=".($month+1)."&year=".$year.">>></a>";<br />//<--------上一年,下一年,上月,下月的連接處理及輸出;結(jié)束---------> <br />?></td></tr> <br /><tr align=center><td><font color="red">日</font></td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr><tr> <br /><?php <br />$d=date("d");<br />$FirstDay=date("w",mktime(0,0,0,$month,1,$year));//取得任何一個月的一號是星期幾,用于計算一號是由表格的第幾格開始<br />$bgtoday=date("d");<br />function font_color($month,$today,$year){//用于計算星期天的字體顏色<br />	$sunday=date("w",mktime(0,0,0,$month,$today,$year));<br />	if($sunday=="0"){<br />		$FontColor="red";<br />	}else{<br />		$FontColor="black";<br />	}<br />	return $FontColor;<br />}<br />function bgcolor($month,$bgtoday,$today_i,$year){//用于計算當(dāng)日的背景顏色<br />	$show_today=date("d",mktime(0,0,0,$month,$today_i,$year));<br />	$sys_today=date("d",mktime(0,0,0,$month,$bgtoday,$year));<br />	if($show_today==$sys_today){<br />	$bgcolor="bgcolor=#6699FF";<br />	}else{<br />	$bgcolor="";<br />	}<br />	return $bgcolor;<br />}<br />function font_style($month,$today,$year){//用于計算星期天的字體風(fēng)格<br />	$sunday=date("w",mktime(0,0,0,$month,$today,$year));<br />	if($sunday=="0"){<br />		$FontStyle="<strong>";<br />	}else{<br />		$Font;<br />	}<br />	return $FontStyle;<br />}<br />for($i=0;$i<=$FirstDay;$i++){//此for用于輸出某個月的一號位置<br />	for($i;$i<$FirstDay;$i++){<br />		echo "<td align=center> </td>\n";<br />	}<br />	if($i==$FirstDay){<br />		echo "<td align=center ".bgcolor($month,$bgtoday,1,$year)."><font color=".font_color($month,1,$year).">".font_style($month,1,$year)."1</font></td>\n";<br />		if($FirstDay==6){//判斷1號是否星期六<br />			echo "</tr>";<br />		}<br />	}<br />}<br />$countMonth=date("t",mktime(0,0,0,$month,1,$year));//某月的總天數(shù) <br />for($i=2;$i<=$countMonth;$i++){//輸出由1號定位,隨后2號直至月尾的所有號數(shù)<br />	echo "<td align=center ".bgcolor($month,$bgtoday,$i,$year)."><font color=".font_color($month,$i,$year).">".font_style($month,$i,$year)."$i</font></td>\n";<br />	if(date("w",mktime(0,0,0,$month,$i,$year))==6){//判斷該日是否星期六<br />		echo "</tr>\n";<br />	}<br />}<br />?> <br /></table>


? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

?? ??

?? : ????? ????? ??
1 ? ? ? By DDD
?? ?? ??
3 ? ? ? By Jack chen
???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

?? ????
1790
16
Cakephp ????
1732
56
??? ????
1582
29
PHP ????
1451
31
???
?? PHP ?? ? ?? ??? ??? ?? ??? ?????? ?? PHP ?? ? ?? ??? ??? ?? ??? ?????? Jun 23, 2025 am 12:56 AM

tostaycurrentwithphpdevelopments ? bestpractices, followkeynewssources lifephp.netandphpweekly, adgytwithcommunitiesonforumsandconferences, readlingupdated andgrad indewfeatures, andreadorcontributetoopensourceproceprosts.first

PHP ? ???? ? ??? ? ?????? PHP ? ???? ? ??? ? ?????? Jun 23, 2025 am 12:55 AM

phpbecamepupularforwebdevelopmentduetoiteofleneflening, whithhtml, wididepreadhostingsupport, andalargeecosystemincludingframeworkslikelaravelandcmsplatformsformslikewordpress.itexcelsinhandlingformsubmissions, managingussess, interptisussivers, ?? ???

PHP ???? ???? ??? PHP ???? ???? ??? Jun 25, 2025 am 01:00 AM

TOSETTHERIGHTTIMEZONEINPHP, usedate_default_timezone_set () functionattStartOfyourscriptwitHavalidInlifiersuchas'America/new_york'.1.edate_default_timezone_set () beforeanydate/timeFunctions.2

PHP?? ??? ??? ???? ?? ??? ????? ??? ?????? PHP?? ??? ??? ???? ?? ??? ????? ??? ?????? Jun 22, 2025 am 01:00 AM

TovalidateUserInputInphp, useBuilt-invalidationFunctions likefilter_var () ? filter_input (), applyRegulArexPessionSforCustomFormatsSuchasUsUserPhonEnumbers, CheckDatatypesFornumericValuesLikeAgeArPrice, setLtrimtsAnspacetReopeTopeTopeTopePeTopePeTopePeTopeTopeTopeTlyout

???? ?? ?? ??? PHP ??? ?????? ?? ??? ?????? ???? ?? ?? ??? PHP ??? ?????? ?? ??? ?????? Jun 24, 2025 am 12:53 AM

???? ???? ?? PHP ??? ???? ??? ??, ???? ??? ?? ??? ?? ??? ????. ??? ??? ???? ? ?????. 1. $ userData ? calculateToTalPrice ()? ?? ??? ??, ?? ? ??? ??? ??????. 2. PSR-12 ?? ?? ?? ???? ?????. 3. ??? ?? ?? ??? ???? MVC ?? Laravel ??? ????? ???? ??????. 4. ?? ??? ??? ??? ?? ???? ??? ?? ???? ????. 5. ? ???? ??? ???? ????? ??? ???? ?? ??, ?? ? ? ??? ??????. 6. ??? ??? ??, ??? ?? ??, ??? ?? ? ?? ??? ????. ??? ??? ?? ??, ?? ??? ? ?? ?? ? ???? ??????.

php (serialize (), unserialize ())? ??? ??? ? ?????? php (serialize (), unserialize ())? ??? ??? ? ?????? Jun 22, 2025 am 01:03 AM

thephpfunctionserialize () andunserialize () areusedtoconvertcomplexDattoresintostorasandabackagain.1.serialize () c onvertsDatalikeCarraysorObjectSrayStringStringStrainingTainingTypeanDtuctureIncomation.2.

HTML ??? PHP ??? ??? ?????? HTML ??? PHP ??? ??? ?????? Jun 22, 2025 am 01:00 AM

PHP ??? HTML ??? ???? ? ??? ??? ???? .php? ?? ??? ??? ???? ??? ???? ?? ?? ? ? ??? ??????. ?? ??? ???? PHP ??? ???? HTML? ?? ???? ?? ???? ??????. ?? ??? ???? PHP ? HTML? ?? ? ???? ??? ???? ?? ?? ??? ??? ? ????. ?? ???, ?? ?? ?? ?? ?? ? ?? ???? ?? ??? ??? ?? ?? ?? ? ?? ??????? ???????.

PHP? ???? SQL ??? ??? ?????? PHP? ???? SQL ??? ??? ?????? Jun 24, 2025 am 12:54 AM

?, youcanrunsqlqueriesusingphp, andtheprocessinvolveschoingadatabaseexextension, executequeriessafely, andclosingconnectionswhendone.todothis, firstchoosebetween -mysqliorpdo, withpdobeingmoreflectibleblyblyblyblyblyblyblyblyblyblyblyblyblyblyblybledingmuttitatabas

See all articles