2013-03-19 59 views
0

我很困惑,为什么我的日期函数没有出现在这段代码中,当我用chrome打开时。该文件保存为.php文件。我是昨天刚刚开始使用PHP的全新软件,并且希望尝试向我的HTML代码中添加一些代码,目前我将不胜感激。PHP日期函数没有出现

<html> 
<head> 
    <title>David Iacovino</title> 
</head> 
<body bgcolor="62,54,100"> 
<center> 
<h1>Page</h1> 
<br></br> 
<font size="4", color = "gray", face = "times new roman">Monday Evenings 6:30-9:15</font> 
<img src="http://cdn.bleacherreport.net/images_root/slides/photos/000/268/563/cesar_logo1_display_image.jpg?1277255126" height= 100 width= 100> 
<br></br> 
<a href="https://www.facebook.com/"</a>Facebook</a> 
<br></br> 
<?php 
    date_default_timezone_set('UTC'); 
    echo date("l"); 
?> 
</center> 
</body> 
</html> 
+0

你启用了PHP的服务器上进行测试呢? – prodigitalson 2013-03-19 05:41:43

+0

尝试echo date('Y-m-d'); – Kautil 2013-03-19 05:41:47

回答

0

您需要创建.php文件而不是.html文件来运行php代码。并且还需要php服务器来运行php代码。你可能需要像服务器一样的apache。尝试下载XAMPP,然后尝试

+0

下载xampp和一切工作很好,谢谢。 – 2013-03-19 23:27:09

0
date_default_timezone_set('UTC'); // misspelled default 

echo date("l"); 
1

改变这种

date_deafault_timezone_set('UTC'); // deafault 

date_default_timezone_set('UTC');