我有一个包含html和php的php页面。我有以下代码:
for ($x = 0; $x <= 100; $x++) {
$result = convertTemp($x);
$tempdesc = getTempName($x);
$textcolor = "blue";
echo ($x . " degrees F is equal to " . round($result, 1) . " C, which is " . '<span id="<?php $textcolor ?>" >' . $tempdesc . '</span>' ."<br/>\n");
}
我想有不同颜色的变量tempdesc
回显,基于上面的$textcolor
变量。现在,我将其设置为“蓝色”,因为我在css中将id设置为蓝色,以便它们应该匹配,单词应该以蓝色回显,但文本不会改变颜色。
https://stackoverflow.com/questions/50778395
复制相似问题