在 PHP 视图中访问数组中的数组
这是来自这个<的附加问题/a>.
我有一个包含多个值和数组的数组。我知道我可以使用
$data['property'] = value;
And 因为我在将 $data 发送给它后就在视图中,所以我知道我可以
echo $PROPERTY;
但是,这个数组还包含数组。
[0] => Array ( [CSS] => css/style_centre_paiement_paiements_1.css [PAGE_NAME] =>
ACCUEIL [RANK] => PARENT [THREAD] => Accueil [FULL_NAME] => Marc Bélanger [C1] => Accueil
[C2] => Inscription - Enfant
[C3] => Centre de Paiement
[C4] =>Nous contacter
[C5] =>Votre compte
[C6] =>
[C7] =>Déconnexion
)[1] => Array ( [0] => Array ( [TITRE]...
[1] 包含多个 [TITRE]、[MESSAGE][DATE] 集的数组。现在,通过将此总数组发送到视图,我可以回显 $THREAD 之类的内容并获取正确的值。但是我应该如何继续访问每组的值呢?由于集合数组在 [1] 中,然后在 [0] 中,我真的不知道该怎么做。我不想重复 [TITRE],因为有不止一个 [TITRE],我想展示所有这些,而不仅仅是一个。我想做的是做这样的事情:
foreach ($alert as $row)
{
....
}
有什么线索可以提供帮助吗?
This is an additional question from this.
I have this array containing multiple values as well as arrays. I know that I can use
$data['property'] = value;
And since I'm in the view after sending the $data to it, I know I can
echo $PROPERTY;
However, this array also contains arrays.
[0] => Array ( [CSS] => css/style_centre_paiement_paiements_1.css [PAGE_NAME] =>
ACCUEIL [RANK] => PARENT [THREAD] => Accueil [FULL_NAME] => Marc Bélanger [C1] => Accueil
[C2] => Inscription - Enfant
[C3] => Centre de Paiement
[C4] =>Nous contacter
[C5] =>Votre compte
[C6] =>
[C7] =>Déconnexion
)[1] => Array ( [0] => Array ( [TITRE]...
The [1] contains an array of several [TITRE],[MESSAGE][DATE] sets. Right now, by sending this total array to the view, I can echo things like $THREAD and get the correct value. But how should I proceed to access the value of each of my sets ? Since the array of sets is in [1], then [0], I don't really know how to do it. And I don't want to to echo [TITRE] because there is more than one [TITRE] and I want to show them all, not just one. What I would like would be to do something like this :
foreach ($alert as $row)
{
....
}
Any clue how to help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不太确定你的意思,但如果你想对数组执行 foreach() ,你可以尝试
Not really sure what you mean, but if you want to do a foreach() with an array you could try