Home > Backend Development > PHP Tutorial > PHP的时间戳让JS显示,显示不正确!该怎么处理

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

WBOY
Release: 2016-06-13 10:06:24
Original
740 people have browsed it

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>
Copy after login


------解决方案--------------------
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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template