渣技术勿喷
- $friday = strtotime("next Friday 18:00:00");
- $time = time();
- $s = $friday-$time;
- $days = floor($s/24/60/60); //剩余天数
- $hour = floor( ($s-$days*24*60*60)/60/60 ); //剩余小时
- $minute = floor( ($s-$days*24*60*60-$hour*60*60)/60 ); //剩余分钟
- $second = floor($s-$days*24*60*60-$hour*60*60-$minute*60); //剩余秒数
- echo json_encode(array('days'=>$days , 'hour'=>$hour , 'minute'=>$minute , 'second'=>$second ));
- ?>
复制代码
- 还有多久解放哦
-
- window.setInterval(function(){
- $.get("djs.php", function(data){
- eval("var data = " data);
- insert('days',data.days);
- insert('hour',data.hour);
- insert('minute',data.minute);
- insert('second',data.second);
- });
- },1000);
- function insert(id,time){
- var insert = document.getElementById(id);
- insert.innerHTML = time;
- }
- 离解放还有:天小时分秒
复制代码
|