PHP实时显示服务器时间

Deloz,2010年07月30日22时59分29秒,经典代码,评论(3),阅读(203),Via 本站原创

zhengsky的博客上看到

他的代码是JS根据客户端时间计算的.

发个PHP实时显示服务器时间代码:

<?php
date_default_timezone_set('PRC');//设置为默认时区为中国
?>
<script language="JavaScript">
<!--
var c=0;
function stime() {
c++;
sec=<?php echo time()-strtotime('1970-1-1')?>+c;
House=Math.floor(sec/3600)%24;
Month=Math.floor(sec/60)%60;
Second=sec%60;
if(Month<10) Month='0'+Month;
if(Second<10) Second='0'+Second;
document.getElementById("deloz_time").value = House+'时'+Month+'分'+Second+'秒';
}
setInterval(stime,1000);
//-->
</script>
<input type="text" name="deloz_time" id="deloz_time" size="18" readonly="readonly">

相关文章

  • 暂无相关日志

转载原创文章请注明,转载自: Deloz.Net [Deloz.Net]
本文地址:http://deloz.net/1000000507.html

3条评论 发表评论

  1. 1楼alige 评论于2010年7月31日08时09分03秒 回复   

    老兄的教程真是言简意赅啊!不错不错! 改天我也弄个!

  2. 2楼zhengsky 评论于2010年7月31日14时07分08秒 回复   

    = =、
    我发现每次我都是反例教材的说。。。。。 :evil:

  3. 3楼alige 评论于2010年7月31日16时05分17秒 回复   

    老哥 给你点名了。。。 :!:

评论一下


(支持Ctrl + Enter)