视图不显示控制器数组的内容
我有一个控制器,它从模型函数中提取数据并将数据存储在数组中:
$row = $this->model_catalog_manufacturer->getAllManufacturers();
$this->data['manufacturer']= array(
'manufacturer_id' => $row['manufacturer_id'],
'name' => $row['name'],
'image' => $row['image']
);
视图只需获取数组并使用 foreach 循环和列表项迭代值。出现了列表项,但没有出现数组的文本值:
<ul>
<?php foreach ($manufacturer as $manuf) {?>
<li><?php echo $manuf['name'];?></li>
<?php }?>
</ul>
有什么想法吗?
I have a controller that pulls data from a model function and stores the data in an array:
$row = $this->model_catalog_manufacturer->getAllManufacturers();
$this->data['manufacturer']= array(
'manufacturer_id' => $row['manufacturer_id'],
'name' => $row['name'],
'image' => $row['image']
);
The view simply take the array and iterates the values using a foreach loop and list items. The list items are appearing but not the text value of the array:
<ul>
<?php foreach ($manufacturer as $manuf) {?>
<li><?php echo $manuf['name'];?></li>
<?php }?>
</ul>
Any ideas why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一下吗
你可以尝试
instead of
could you try