首頁 >後端開發 >php教程 >PHP的时间戳让JS显示,显示不正确!该怎么处理

PHP的时间戳让JS显示,显示不正确!该怎么处理

WBOY
WBOY原創
2016-06-13 10:06:24739瀏覽

PHP的时间戳让JS显示,显示不正确!

HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>时间</title><script type="text/javascript">var time = new Date(<?php echo(time());?> * 1000);alert(time.getFullYear() + "-" + time.getMonth() + "-" + time.getDay() + " " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds());</script>


------解决方案--------------------
HTML code
[code=PHP]<meta http-equiv="Content-Type" content="text/html, charset=utf-8"><title>时间</title><?php echo date('Y-m-d H:i:s');?><br><script type="text/javascript">var time = new Date(<?php echo(time());?>*1000);document.write(time.getFullYear() + "-" + (time.getMonth()+1) + "-" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds());</script><div class="clear">
                 
              
              
        
            </div>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn