我如何从 zfcUser 获取状态
在 view/index.phtml 中,我从 $this->zfcUserIdentity()->getState(); 获取它;
但现在我需要在其他模块/ Controller (这是我的costum模块 Controller )中获取这个值(已登录的用户的状态)
所以我需要从以下位置获取状态: zfc用户/实体/用户 到 我的模块/ Controller
我看这个https://github.com/ZF-Commons/ZfcUser/wiki/How-to-check-if-the-user-is-logged-in但这个解决方案没有帮助
最佳答案
这对我来说也有帮助:
$sm = $this->getServiceLocator();
$auth = $sm->get('zfcuserauthservice');
if ($auth->hasIdentity()) {
$user_edit = $auth->getIdentity()->getPrem();
}
关于module - zfcUser getState 在另一个模块中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14015601/