我有数组的以下对象并试图获取电子邮件的值。怎么办呢?
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] =>
)
)
)
目前我可以使用以下foreach访问日期值。
foreach ($fnret->data as $msg)
{
echo $msg->date; // shows 2013-01-28 08:35:59
}
答案 0 :(得分:5)
这个应该有效:
foreach ($fnret->data as $email => $msg) {
// echo $msg->date; // shows 2013-01-28 08:35:59
echo $email;
}