CodeIgniter 访问视图中的多维数组

发布于 2024-10-02 16:15:20 字数 424 浏览 0 评论 0原文

我有一个小问题。在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

横笛休吹塞上声 2024-10-09 16:15:20

好的,我已经修好了。事实证明这是一个非常简单的错误,事实证明我对 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文