代码示例:(标识:demo_php_if)
<!DOCTYPE html>
<html>
<body>

<?php
$t=date("H");

if ($t<"20") {
   echo "Have a good day!";
}
?>
  
</body>
</html>
运行结果: