PHP MySQL如果今天是星期天,则禁用按钮

时间:2016-09-10 16:09:46

标签: php html

需要一些关于如何禁用按钮的帮助。使用HTML / PHP

如果今天是星期天,请禁用按钮。

<button>Disable Me</button>

否则如果今天是工作日,(从早上8点到下午5点)按钮处于活动状态。否则,该按钮被禁用。

if(8am to 5pm){

<button>Active</button>

}else{
<button>Disable Me</button>

1 个答案:

答案 0 :(得分:1)

$current_date_array = getdate();

if($current_date_array['weekday'] == "Sunday" || $current_date_array['hours'] < 8 || $current_date_array['hours'] > 17){
    //disable the button
} else {
    //enable
}

这意味着

如果(今天是星期日或时间不到上午8点或时间大于下午5点))

相关问题