目前時間2024/11/21 11:57:17
4在Hello 午安<?php //在function.php內指定一個指令,指令為gettimemgs function gettimemsg(){ echo "4在Hello "; $myH = date("G");//目前小時 if($myH >= 6 && $myH <11 ){ echo "早安"; } elseif($myH >= 11 && $myH <15 ){ echo "午安"; } elseif($myH >= 15 && $myH <17 ){ echo "傍晚黃昏、再努力一下"; } elseif($myH >= 17 && $myH <19 ){ echo "下班回家請慢走"; } elseif($myH >= 19 && $myH <22 ){ echo "還在忙嘛?記得收拾收拾囉!"; } elseif($myH >= 22){ echo "快去洗洗睡"; } elseif($myH <6 ){ echo "睡睡睡zzZZ"; } } //在此檔案中,引入function.php後,並執行該指令 include("include/function.php"); gettimemsg(); ?>