我访问数组时不显示数组结果,如何访问此数组中的特定字段值

时间:2014-11-08 05:50:49

标签: php

Array ( [0] => 
    Array ( 
      [Bounces] => 1 
      [Complaints] => 0 
      [DeliveryAttempts] => 405 
      [Rejects] => 0 
      [Timestamp] => 2014-11-07T11:47:00Z ) 

        [1] => etc etc
        // Multiple array values are here
     );

1 个答案:

答案 0 :(得分:1)

它是一个简单的多维数组。

就这样做..

 foreach($yourArray as $val){
     foreach($val as $v){
            echo $v['Bounces']."<br>";
            echo $v['Complaints']."<br>"; // etc etc
     }

 }

或者,如果您想直接获取值而不循环

 $yourArray[0]['Complaints']; // Complaints attribute of 1st array entry
 $yourArray[1]['Bounces']; // Bounce attribute of 2nd array entry
 $yourArray[4]['Rejects']; //Rejects attribute of 5th array entry