我只需要它的最后 2 条记录。下面的代码返回所有记录。谢谢你
<?php
foreach ($fields as $field) {
$type = $field['s_type'];
$label = $field['s_label'];
$value = Attributes::newInstance()->getValue($item_id, $field['pk_i_id']);
if ($type == 'checkbox') {
if ($value == 'checked') $value = 'Yes';
else $value = 'No';
}
?>
<tr>
<td style='width: 150px;'><?php _e($label, pg); ?></td>
<td style='width: 150px;'><?php _e($value, pg); ?></td>
</tr>
<?php } ?>