我将如何出去显示这些信息,以便颜色代码正确显示文本?这只是一个小片段,但我似乎无法让它工作。我试图使它成为一个数组但被卡住了。
if($pclass == "c1" or "c2" or "c3" or "c4" or "c5"){
$pcolor = '<font color="#0000FF">';
$pend = '</font>';
} else {
if($pclass == "w1" or "w2" or "w3" or "w4" or "w5"){
$pcolor = "<font color='#FF6600'>";
$pend = "</font>";
} else {
if($pclass == "r1" or "r2" or "r3" or "r4" or "r5"){
$pcolor = "<font color='#00FF00'>";
$pend = "</font>";
} else {
if($pclass == "h1" or "h2" or "h3" or "h4" or "h5"){
$pcolor = "<font color='#CC00CC'>";
$pend = "</font>";
}
}
?>
<div id="top">
<h1>
<?php echo "$requestname"; ?>
</h1>
<p class="small">
<?php
echo "$player's primary class is $pcolor $pclass $pend";
echo ", $player's secondary class is $sclass";