我有一个 PHP 数组,如下所示:
Array
(
[2] => Array
(
[_diskquota] => 524288000
[_diskused] => 0
[diskquota] => 500
[diskused] => 0
[diskusedpercent] => 0
[diskusedpercent20] => 0
[domain] => domain1.com
[email] => aaa@domain1.com
[humandiskquota] => 500 MB
[humandiskused] => None
[login] => aaa@domain1.com
[mtime] => 1378636684
[txtdiskquota] => 500
[user] => aaa
)
[3] => Array
(
[_diskquota] => 0
[_diskused] => 0
[diskquota] => unlimited
[diskused] => 0
[diskusedpercent] => 0
[diskusedpercent20] => 0
[domain] => domain2.com
[email] => ddd@domain2.com
[humandiskquota] => None
[humandiskused] => None
[login] => ddd@domain2.com
[mtime] => 1378636684
[txtdiskquota] => unlimited
[user] => ddd
)
[4] => Array
(
[_diskquota] => 104857600
[_diskused] => 0
[diskquota] => 100
[diskused] => 0
[diskusedpercent] => 0
[diskusedpercent20] => 0
[domain] => domain3.com
[email] => sss@domain3.com
[humandiskquota] => 100 MB
[humandiskused] => None
[login] => sss@domain3.com
[mtime] => 1378636684
[txtdiskquota] => 100
[user] => sss
)
)
如何在 php foreach 中获得这样的结果?(我不想列出其他值)
电子邮件 | 人类磁盘配额| 人类磁盘使用
我的尝试代码。foreach 正在运行,但我无法从数组中获取电子邮件值。
foreach ($d as $arr => $key)
{
foreach ($key as $k => $v)
{
//echo "$k: $v<br>";
echo $email=$k['email'].' | ';
echo $email=$v['email'].' | ';
echo $email=$v->email.' | ';
echo $email=$k->email.' | ';
}
echo "<br>";
}