문제

I have the following objects with arrays and trying to get the value of email. How can this be done?

stdClass Object (
    [status] => stdClass Object ( 
        [info] => Unsubscribe List [code] => 200 
    ) 
    [data] => Array ( 
        [o1958147@rtrtr.com] => stdClass Object ( 
            [date] => 2013-01-28 08:09:19 
            [origin] => 
        ) 
        [phil.houston@granherne.com] => stdClass Object ( 
            [date] => 2013-01-28 08:35:59 
            [origin] => 
        ) 
    )    
) 

Currently i can access the date values with the following foreach.

foreach ($fnret->data as $msg)
{
    echo $msg->date;      // shows 2013-01-28 08:35:59
}
도움이 되었습니까?

해결책

This one should work :

foreach ($fnret->data as $email => $msg) {
    // echo $msg->date;      // shows 2013-01-28 08:35:59
    echo $email;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top