標題:
switch 判斷式
[打印本頁]
作者:
tonyh
時間:
2013-10-24 21:25
標題:
switch 判斷式
<html>
<head>
<title>switch 判斷式</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<?php
date_default_timezone_set("America/New_York"); //Asia/Taipei America/New_York Pacific/Honolulu Europe/London
echo "現在時刻: ".date("D, F j, Y, H:i:s")."<p/>";
switch(date("H"))
{
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
echo "Good Morning!<p/>";
break;
case 12:
case 13:
case 14:
case 15:
case 16:
echo "Good Afternoon!<p/>";
break;
case 17:
case 18:
case 19:
case 20:
echo "Good Evening!<p/>";
break;
default:
echo "Good Night!<p/>";
}
?>
</body>
</html>
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2