循环实现1列4行
<?php foreach ($list as $key=>$product): ?>
<?php echo $key % 4 == 0 ? "<tr>" : ""; ?>
<td>
<img class="dj-info" src="img.png">
</td>
<!--不够4个空的td,循环补充4 td-->
<?php if ($key == count($list) - 1 && (count($list) % 4)): ?>
<?php for ($i = 0; $i < 3 - $key % 4; $i++): ?>
<td><a class="dj-info"></a></td>
<?php endfor; ?>
<?php endif; ?>
<?php echo ($key + 1) % 4 == 0 || ($key == count($list) - 1) ? "</tr>" : ""; ?>
<?php endforeach; ?>