CodeIgniter 访问视图中的多维数组
我有一个小问题。在我的 CodeIgniter 控制器中,我将同一视图多次加载到数组中。每个视图都分配有一个值,该值又被添加到 $data 数组中以传递给视图。我现在在从主模板视图中的 $data 数组中获取数据时遇到问题。
下面是我创建数组的方法:
$data['views'][$current_value][$counter] = $this->load->view('sub_view', $data, true);`
这是在 while 循环内,循环遍历 $counter 直到获得所需的所有数据。因此,完成的数组将具有视图,其中包含许多当前值,每个视图都有许多计数器。
我应该使用什么代码来尝试将其从主视图中的数组中取出?我尝试过很多不同的方法!这不是打球。有没有人有任何想法。干杯!
闪闪发光
I've got a little problemo. In my CodeIgniter Controller I'm loading the same view many times into an array. Each view is assigned to a value, which in turn is added to the $data array to pass to the view. I'm now having problems getting the data back out of the $data array in the master template view.
Here's how I created the array:
$data['views'][$current_value][$counter] = $this->load->view('sub_view', $data, true);`
This is inside a while loop which cycles through $counter until I've got all the data I need. So the finished array will have views, which have many current values, each which have many counters.
What code should I use to try and get this out of the array in the master view? I've tried so many different methods! It's not playing ball. Has anyone got any ideas. Cheers!
Sparkles
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我已经修好了。事实证明这是一个非常简单的错误,事实证明我对 CodeIgniter 中的多维数组的了解还不错。再见x
Okay, I've fixed it. Turns out it was quite a simple mistake, turns out my knowledge of multi-dimensional arrays in CodeIgniter is not bad. Byeee x