我正在尝试这个,但似乎对我不起作用。我参考了here。以下是我的代码:
$today = date('Y-m-d');
$date = new DateTime();
$R1D2 = $date->setISODate($year,$week,1)->format('Y-m-d');
<td width="14.285%" <?php if ($R1D2 = $today): ?> style="background:#EEEEEE" <?php endif ?>>some content here </td>
结果是,所有单元格都会改变其背景,即使它与$today
不相等
答案 0 :(得分:5)
$R1D2
您实际上将$today
设为if ($R1D2 == $today):
。请将该行更改为:
{{1}}