2017-04-06 30 views

回答

0

請使用此代碼:

<?php 
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 
$customer = $objectManager->get('Magento\Customer\Model\Customer'); 
$customer->setWebsiteId('1'); 
$customer->loadByEmail('[email protected]'); 
?> 
0

你也可以試試這個:下面的代碼

protected $customerCollection; 

public function __construct(
    ... 
    \Magento\Customer\Model\Customer $customerCollection, 
    ...  
) 
{ 
    ... 
    $this->customerCollection = $customerCollection; 
    ... 
} 

使用你的函數: -

$customerObj = $this->customerCollection; 
$customerObj->setWebsiteId($websiteId); 
$customerObj->loadByEmail('[email protected]'); 
相關問題