我网站现在的限制访问时间段是24小时制,也就是可以从开始时间00:01到24:00结束,现在我想要从开始时间10:00到02:00结束就用不了,请问怎么用代码可以这样限制时间访问吗?
回复讨论(解决方案) 获取当前时间,不是容许的时间段给出提示。。。
24小时制,开始时间10:00到02:00结束
这不就跨天了吗?
所以你要分2段设置
00:00 到 02:00
10:00 到 24:00
24小时制,开始时间10:00到02:00结束
这不就跨天了吗?
所以你要分2段设置
00:00 到 02:00
10:00 到 24:00
能发下代码吗?
你原来只有类似
date('h:i') >= $起始时间 and date('h:i') 这样一条判别
加一条判别就是
date('h:i') >= $起始时间1 and date('h:i') or
date('h:i') >= $起始时间2 and date('h:i')
你原来只有类似
date('h:i') >= $起始时间 and date('h:i') 这样一条判别
加一条判别就是
date('h:i') >= $起始时间1 and date('h:i') or
date('h:i') >= $起始时间2 and date('h:i') 这样不起冲突吗?
你原来只有类似
date('h:i') >= $起始时间 and date('h:i') 这样一条判别
加一条判别就是
date('h:i') >= $起始时间1 and date('h:i') or
date('h:i') >= $起始时间2 and date('h:i') 版主,麻烦给个完整的代码。
冲什么突?
你原来只有类似
date('h:i') >= $起始时间 and date('h:i') 这样一条判别
加一条判别就是
date('h:i') >= $起始时间1 and date('h:i') or
date('h:i') >= $起始时间2 and date('h:i') 这样不起冲突吗?
冲什么突?
你原来只有类似
date('h:i') >= $起始时间 and date('h:i') 这样一条判别
加一条判别就是
date('h:i') >= $起始时间1 and date('h:i') or
date('h:i') >= $起始时间2 and date('h:i') 这样不起冲突吗?
版主,麻烦发个全部代码好吗?
自己不会写?
那就把你原来的这部分贴出来
不然我给你写了,你也弄不进去
自己不会写?
那就把你原来的这部分贴出来
不然我给你写了,你也弄不进去 //提示时间检查 $fromtime=strtotime(date('y-m-d ',$this->time).$this->settings['cashfromtime'].':00'); $totime=strtotime(date('y-m-d ',$this->time).$this->settings['cashtotime'].':00'); if($this->time time > $totime ) throw new exception(对不起,已过提现时间,请在合适的时间提交!
提现时间:.$this->settings['cashfromtime']. ~ .$this->settings['cashtotime']); $this->begintransaction(); try{ $this->freshsession(); if($this->user['coinpassword']!=md5($para['coinpwd'])) throw new exception('资金密码不正确'); unset($para['coinpwd']); if($this->user['coin']time).$this->settings['cashfromtime'].':00'); $totime=strtotime(date('y-m-d ',$this->time).$this->settings['cashtotime'].':00'); if($this->time time > $totime ) throw new exception(对不起,已过提现时间,请在合适的时间提交!
提现时间:.$this->settings['cashfromtime']. ~ .$this->settings['cashtotime']); $this->begintransaction(); try{ $this->freshsession(); if($this->user['coinpassword']!=md5($para['coinpwd'])) throw new exception('资金密码不正确'); unset($para['coinpwd']); if($this->user['coin']<$para['amount']) throw new exception('你帐户资金不足');
目前是24小时制的,我需要的是跨天时间,比如08点到02点,上面是我的php代码,请问怎么改?
strtotime(date(y-m-d)); //00:00strtotime(date(y-m-d 02:00)); //02:00strtotime(date(y-m-d 22:00)); //22:00strtotime(date(y-m-d 24:00)); //24:00