【发布时间】:2019-04-11 02:13:44
【问题描述】:
遇到 PHP 错误 严重性:警告
消息:为 foreach() 提供的参数无效
文件名:admin/v_pembelian.php
行号:80
<tbody>
<?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items){ ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
<tr>
<td><?=$items['id'];?></td>
<td><?=$items['name'];?></td>
<td style="text-align:center;"><?=$items['satuan'];?></td>
<td style="text-align:right;"><?php echo number_format($items['price']);?></td>
<td style="text-align:right;"><?php echo number_format($items['harga']);?></td>
<td style="text-align:center;"><?php echo number_format($items['qty']);?></td>
<td style="text-align:right;"><?php echo number_format($items['subtotal']);?></td>
<td style="text-align:center;"><a href="<?php echo base_url().'admin/pembelian/remove/'.$items['rowid'];?>" class="btn btn-warning btn-xs"><span class="fa fa-close"></span> Batal</a></td>
</tr>
<?php $i++; ?>
<?php } ?>
</tbody>
我想显示已插入项目的数据
【问题讨论】:
-
看起来
$this->cart->contents()不可迭代
标签: php codeigniter foreach