- <html>
- <head>
- <title>if...else if...else 判斷式</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
- <body>
- <?php
- date_default_timezone_set('Asia/Taipei'); //Asia/Taipei America/New_York Pacific/Honolulu Europe/London
- if(date("H")>=5 && date("H")<12)
- {
- echo "Good Morning!<p/>";
- }else if(date("H")>=12 && date("H")<17)
- {
- echo "Good Afternoon!<p/>";
- }else if(date("H")>=17 && date("H")<21)
- {
- echo "Good Evening!<p/>";
- }else
- {
- echo "Good Night!<p/>";
- }
- echo date('D, F j, Y, H:i:s A');
- ?>
- </body>
- </html>
複製代碼 |