首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

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

2012-04-18 
PHP的时间戳让JS显示,显示不正确!HTML code!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//

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

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>时间</title></head><body><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></body></html>


[解决办法]
HTML code
[code=PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html, charset=utf-8" /><title>时间</title></head><body><?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></body></html> 

热点排行