作为练习的一部分,我试图在一页上列出我数据库中所有用户的电子邮件。到目前为止,我最接近的是
$user = mage::getModel('customer/customer')->getCollection()->getData();
退货
array
0 =>
array
'entity_id' => string '1' (length=1)
'entity_type_id' => string '1' (length=1)
'attribute_set_id' => string '0' (length=1)
'website_id' => string '1' (length=1)
'email' => string 'john.doe@example.com' (length=20)
'group_id' => string '1' (length=1)
'increment_id' => string '000000001' (length=9)
'store_id' => string '1' (length=1)
'created_at' => string '2007-08-30 23:23:13' (length=19)
'updated_at' => string '2008-08-08 12:28:24' (length=19)
'is_active' => string '1' (length=1)
'disable_auto_group_change' => string '0' (length=1)
1 =>
array
'entity_id' => string '2' (length=1)
'entity_type_id' => string '1' (length=1)
'attribute_set_id' => string '0' (length=1)
'website_id' => string '1' (length=1)
'email' => string 'tony09uk@gmail.com' (length=18)
'group_id' => string '1' (length=1)
'increment_id' => null
'store_id' => string '1' (length=1)
'created_at' => string '2013-07-19 14:31:00' (length=19)
'updated_at' => string '2013-07-19 14:31:00' (length=19)
'is_active' => string '1' (length=1)
'disable_auto_group_change' => string '0' (length=1)
但是我只希望列出他们的电子邮件,但我尝试过使用吸气剂和塞洗剂,但是却没有办法(或者至少不是我使用它们的方式)。我也尝试过
$user = mage::getModel('customer/customer')->getCollection()->load();
和
$user = mage::getModel('customer/customer')->getCollection()
->addAttributeToSort('email', 'ASC');
和
$user = mage::getModel('customer/customer')->getCollection()->getEmail()->getData();
和
$user = mage::getModel('customer/customer')->getCollection()->getData();
echo $user->getEmail();
以及其他几种变体,现在我要说的是,我只是随意添加命令以希望它们能起作用,我不喜欢这样做。
如何为所有用户显示电子邮件?(我希望我离目标不远)