Setting a greeting based on user's time (Good morning, good afternoon…)

后端 未结 6 1963
孤街浪徒
孤街浪徒 2021-02-02 11:13

Can anyone extrapolate on how to implement a basic \"good evening\" or \"good morning\" based on the user\'s time setting?

Perhaps PHP will fetch the server time, but I

6条回答
  •  太阳男子
    2021-02-02 11:25

    = 5 && $Hour <= 11 ) {
        echo "Good Morning";
    } else if ( $Hour >= 12 && $Hour <= 18 ) {
        echo "Good Afternoon";
    } else if ( $Hour >= 19 || $Hour <= 4 ) {
        echo "Good Evening";
    }
    ?>
    

    For more information about date see function.date. I Hope this will help.

提交回复
热议问题