获取有关Opencart当前用户的信息

7 opencart

我一直在使用Opencart开发模块,我想知道如何获取当前用户信息.

我在想这样的事情: $this->getuserid();

小智 20

我刚发现了:

$this->customer->getFirstName();
$this->customer->getLastName();
$this->customer->getEmail();
$this->customer->getTelephone();
$this->customer->getFax();
Run Code Online (Sandbox Code Playgroud)

等等.

源代码(包括其他可用方法)位于system/library/customer.php文件中.

您可以在任何地方使用这些方法.

希望这可以帮助.


yma*_*kux 8

客户和用户之间存在差异.要获取当前用户ID(管理员,经理等),请执行以下操作:

$this->session->data['user_id'];
Run Code Online (Sandbox Code Playgroud)