Rumah >pembangunan bahagian belakang >tutorial php >PHP的时间戳让JS显示,显示不正确!该怎么处理

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBasal
2016-06-13 10:06:24782semak imbas

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>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn