我想在注销后重定向用户,这是我的代码:
$app = JFactory::getApplication();
$user = JFactory::getUser();
$user_id = $user->get('id');
$par = array();
$par['return'] = urlencode(base64_encode('index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150'));
$app->logout($user_id,Array('return'=>$par['return']));
答案 0 :(得分:2)
$user = JFactory::getUser();
$app = JFactory::getApplication();
$app->logout($user_id);
$app->redirect(JURI::base().'index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150', $error, 'error' );
或
$app->redirect(JRoute::_('index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150', false));
退出后。
答案 1 :(得分:2)
你应该使用 Joomla!身份验证插件,在该插件中,您可以在onUserAfterLogout
事件中键入重定向代码。