【问题标题】:strange setRedirect action on joomlajoomla上奇怪的setRedirect动作
【发布时间】:2023-03-11 01:44:01
【问题描述】:

我在 Joomla! 的 controller 中看到了 setRedirect 函数的奇怪行为! 我在管理员上有一个方法,允许以用户身份登录。奇怪的是,它在某些机器上运行良好,而在其他机器上,管理员被重定向但没有登录。

我发现问题发生在 Joomla 的 setRedirect 上,因为 header() php 函数运行良好。有人有想法吗?

非常感谢!

public function loginFromAdmin()
{
    $userid = JRequest::getVar('id');
    $user = JUser::getInstance($userid);
    $session =& JFactory::getSession();
    $session->set('user', $user);

    $this->setRedirect('https://abc.com/index.php/xyz');
}

【问题讨论】:

  • 您使用的是什么版本的 Joomla?
  • 我正在使用 Joomla! 2.5.

标签: php redirect joomla controller


【解决方案1】:

使用下面的代码:

$app = JFactory::getApplication();
$app->redirect('https://abc.com/index.php/xyz');

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2012-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多