嗨,我试图以这种格式在 php 中显示当前时间,但背景为蓝色,文本为白色。
Current Time: Fri Sep 21 11:06:46 2007
我的问题是在我的 CSS 文件中,我有以下背景语法......
body{
/* fallback */
background-color: #C0C0C0;
/*background: url(images/linear_bg_2.png);*/
background-repeat: repeat-x;
}
但是在我的PHP文件中,当用户输入正确的时间显示格式时,我的时间应该以蓝色背景和白色文本显示..文本实际上工作正常,但背景没有进行更改。
这是我的 php 文件所拥有的。.
<?php
}// End of IF statement
if($_POST && $_POST['userInput'] == "comp" && $_POST['userInput'] != ""){
?><body style="background-color:#0000CC;color:white;"><?php
date_default_timezone_set('America/Toronto');
echo "Current Time: " . date("D M d H:i:s Y");
?></body><?php
}
好吧,我希望有人知道或能看到我做错了什么。我将不胜感激。
您忘记了十六进制颜色之前的#
。
?><body style="background-color:#0000CC;color:white;"><?php
好吧,我以这种方式解决了问题...
使用步骤
?><body style="background-color:#0000CC;color:white;"><?php
我改成了...
?><body style="background:#0000CC;color:white;"><?php
它使它发生了..覆盖了CSS样式表...谢谢大家..