Php 为登录用户提供不同的颜色
我有一个登录名,一旦你登录,你就会看到一个包含数据库中所有用户的列表 我想用红色之类的颜色突出显示列表中的登录用户。我怎样才能做到这一点?基本上:Php 为登录用户提供不同的颜色,php,mysql,mysqli,Php,Mysql,Mysqli,我有一个登录名,一旦你登录,你就会看到一个包含数据库中所有用户的列表 我想用红色之类的颜色突出显示列表中的登录用户。我怎样才能做到这一点?基本上: <table> <?php foreach($users as &$user) { ?> <tr> <td<?php if ($user == $currentUser) print(" style=\"background-color=red;\""); ?>&
<table>
<?php
foreach($users as &$user) {
?>
<tr>
<td<?php if ($user == $currentUser) print(" style=\"background-color=red;\""); ?>>
<?php print($user); ?>
</td>
</tr>
<?php
}
?>
</table>
您可以设置html元素的不同样式,可能是边框颜色或背景颜色。