2011-11-13 19:23
浏览 29


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 ?

图片转代码服务由CSDN问答提供 功能建议

这是来自 this

我有这个数组包含多个值 作为数组。 我知道我可以使用

  $ data ['property'] = value; 

因为我 在发送$ data后,我在视图中,我知道我可以

  echo $ PROPERTY;  


  [0] => 数组([CSS] => css / style_centre_paiement_paiements_1.css [PAGE_NAME] => 
ACCUEIL [RANK] => PARENT [THREAD] => Accueil [FULL_NAME] =>MarcBélanger[C1] => Accueil  
 [C2] =>铭文 -  Enfant 
 [C3] => Center de Paiement 
 [C4] => Nous contacter 
 [C5] => Votre compte 
 [C6] =>  
 [C7] =>Déconnexion
)[1] => 数组([0] =>数组([TITRE] ... 

[1]包含多个[TITRE],[MESSAGE] [ DATE]设置。现在,通过将这个全数组发送到视图,我可以回复$ THREAD之类的内容并获得正确的值。但是我应该如何继续访问每个集合的值?因为数组是 在[1]中,然后是[0],我真的不知道怎么做。而且我不想回应[TITRE]因为有多个[TITRE]并且我想要全部展示, 不仅仅是一个。我希望做的是这样的事情:

  foreach($ alert as $ row)


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • du5739 2011-11-13 19:30

    Not really sure what you mean, but if you want to do a foreach() with an array you could try

    foreach ($array as $array => $subarray)
    解决 无用
    打赏 举报

相关推荐 更多相似问题