如何獲取登錄的當前用戶會話ID?我正在使用2.0版本。在用戶會話ID中獲得當前日誌
我做了調試($ _ Session),我沒有看到它。
$this->currentUser = $this->User->find('all',$id);
感謝
如何獲取登錄的當前用戶會話ID?我正在使用2.0版本。在用戶會話ID中獲得當前日誌
我做了調試($ _ Session),我沒有看到它。
$this->currentUser = $this->User->find('all',$id);
感謝
使用
$this->Auth->user('id');
您也可以獲取其他數據,採用這種方式。
$this->Auth->user('whatYouWantToGet');
其實我用了session_id(),它給了我想找的東西。感謝您的幫助!
您應該使用SessionComponent來獲取session_id。 在任何控制器中,您都可以使用它
$session_id = $this->Session->id();
您是否在此用戶登錄?那麼它將在'$ this-> Session-> read('Auth.User.id');' – mark 2012-03-23 02:09:55
你使用什麼認證系統登錄它們?如果它們不在'$ _SESSION' var中,那麼它們可能未登錄... – jeremyharris 2012-03-23 02:10:49